diff --git a/package.json b/package.json index 44d22d98b..cfeb3874d 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,7 @@ "@types/long": "^4.0.0", "abort-controller": "^3.0.0", "duplexify": "^4.0.0", - "fast-text-encoding": "^1.0.3", "google-auth-library": "^8.0.2", - "is-stream-ended": "^0.1.4", "node-fetch": "^2.6.1", "object-hash": "^3.0.0", "proto3-json-serializer": "^1.0.0", diff --git a/src/fallbackRest.ts b/src/fallbackRest.ts index 64a54dc37..62a8b5993 100644 --- a/src/fallbackRest.ts +++ b/src/fallbackRest.ts @@ -19,14 +19,9 @@ import * as serializer from 'proto3-json-serializer'; import {defaultToObjectOptions} from './fallback'; import {FetchParameters, FetchParametersMethod} from './fallbackServiceStub'; -import {hasTextDecoder, hasTextEncoder} from './featureDetection'; import {GoogleError} from './googleError'; import {transcode} from './transcoding'; -if (!hasTextEncoder() || !hasTextDecoder()) { - require('fast-text-encoding'); -} - export function encodeRequest( rpc: protobuf.Method, protocol: string, diff --git a/src/featureDetection.ts b/src/featureDetection.ts index 454568869..5a0c0309e 100644 --- a/src/featureDetection.ts +++ b/src/featureDetection.ts @@ -33,14 +33,6 @@ export function hasWindowFetch() { return features.windowFetch; } -export function hasTextEncoder() { - return features.textEncoder; -} - -export function hasTextDecoder() { - return features.textDecoder; -} - export function isNodeJS() { return features.nodeJS; } diff --git a/src/paginationCalls/pageDescriptor.ts b/src/paginationCalls/pageDescriptor.ts index 242e4d130..a4bf867b1 100644 --- a/src/paginationCalls/pageDescriptor.ts +++ b/src/paginationCalls/pageDescriptor.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import * as ended from 'is-stream-ended'; import {PassThrough, Transform} from 'stream'; import {APICaller} from '../apiCaller'; @@ -82,7 +81,7 @@ export class PageDescriptor implements Descriptor { // emit full api response with every page. stream.emit('response', apiResp); for (let i = 0; i < resources.length; ++i) { - if (ended(stream)) { + if ((stream as any)._readableState.ended) { return; } if (resources[i] === null) { @@ -94,7 +93,7 @@ export class PageDescriptor implements Descriptor { stream.end(); } } - if (ended(stream)) { + if ((stream as any)._readableState.ended) { return; } if (!next) {