@smithy/util-stream
Advanced tools
Comparing version 3.2.1 to 3.3.0
@@ -96,2 +96,3 @@ var __defProp = Object.defineProperty; | ||
isReadableStream, | ||
isBlob, | ||
createChecksumStream, | ||
@@ -98,0 +99,0 @@ ChecksumStream |
@@ -7,3 +7,2 @@ "use strict"; | ||
const stream_1 = require("stream"); | ||
const util_1 = require("util"); | ||
const sdk_stream_mixin_browser_1 = require("./sdk-stream-mixin.browser"); | ||
@@ -38,3 +37,3 @@ const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; | ||
else { | ||
const decoder = new util_1.TextDecoder(encoding); | ||
const decoder = new TextDecoder(encoding); | ||
return decoder.decode(buf); | ||
@@ -41,0 +40,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
async function splitStream(stream) { | ||
if ((0, stream_type_check_1.isReadableStream)(stream)) { | ||
if ((0, stream_type_check_1.isReadableStream)(stream) || (0, stream_type_check_1.isBlob)(stream)) { | ||
return (0, splitStream_browser_1.splitStream)(stream); | ||
@@ -11,0 +11,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isReadableStream = void 0; | ||
exports.isBlob = exports.isReadableStream = void 0; | ||
const isReadableStream = (stream) => { | ||
@@ -10,1 +10,6 @@ var _a; | ||
exports.isReadableStream = isReadableStream; | ||
const isBlob = (blob) => { | ||
var _a; | ||
return typeof Blob === "function" && (((_a = blob === null || blob === void 0 ? void 0 : blob.constructor) === null || _a === void 0 ? void 0 : _a.name) === Blob.name || blob instanceof Blob); | ||
}; | ||
exports.isBlob = isBlob; |
import { streamCollector } from "@smithy/node-http-handler"; | ||
import { fromArrayBuffer } from "@smithy/util-buffer-from"; | ||
import { Readable } from "stream"; | ||
import { TextDecoder } from "util"; | ||
import { sdkStreamMixin as sdkStreamMixinReadableStream } from "./sdk-stream-mixin.browser"; | ||
@@ -6,0 +5,0 @@ const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; |
import { PassThrough } from "stream"; | ||
import { splitStream as splitWebStream } from "./splitStream.browser"; | ||
import { isReadableStream } from "./stream-type-check"; | ||
import { isBlob, isReadableStream } from "./stream-type-check"; | ||
export async function splitStream(stream) { | ||
if (isReadableStream(stream)) { | ||
if (isReadableStream(stream) || isBlob(stream)) { | ||
return splitWebStream(stream); | ||
@@ -7,0 +7,0 @@ } |
export const isReadableStream = (stream) => typeof ReadableStream === "function" && | ||
(stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream); | ||
export const isBlob = (blob) => { | ||
return typeof Blob === "function" && (blob?.constructor?.name === Blob.name || blob instanceof Blob); | ||
}; |
@@ -12,2 +12,6 @@ /** | ||
export declare const isReadableStream: (stream: unknown) => stream is ReadableStreamType; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const isBlob: (blob: unknown) => blob is Blob; | ||
export {}; |
@@ -12,2 +12,6 @@ /** | ||
export declare const isReadableStream: (stream: unknown) => stream is ReadableStreamType; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const isBlob: (blob: unknown) => blob is Blob; | ||
export {}; |
{ | ||
"name": "@smithy/util-stream", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"scripts": { | ||
@@ -15,4 +15,8 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'", | ||
"extract:docs": "api-extractor run --local", | ||
"test": "yarn g:jest && yarn g:karma start karma.conf.js", | ||
"test:integration": "yarn g:jest --config jest.config.integ.js" | ||
"test": "yarn g:vitest run && yarn test:browser", | ||
"test:integration": "yarn g:vitest run -c vitest.config.integ.ts", | ||
"test:watch": "yarn g:vitest watch", | ||
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.ts", | ||
"test:browser": "yarn g:vitest run -c vitest.config.browser.ts", | ||
"test:browser:watch": "yarn g:vitest watch -c vitest.config.browser.ts" | ||
}, | ||
@@ -28,5 +32,5 @@ "main": "./dist-cjs/index.js", | ||
"dependencies": { | ||
"@smithy/fetch-http-handler": "^4.0.0", | ||
"@smithy/node-http-handler": "^3.2.5", | ||
"@smithy/types": "^3.6.0", | ||
"@smithy/fetch-http-handler": "^4.1.0", | ||
"@smithy/node-http-handler": "^3.3.0", | ||
"@smithy/types": "^3.7.0", | ||
"@smithy/util-base64": "^3.0.0", | ||
@@ -33,0 +37,0 @@ "@smithy/util-buffer-from": "^3.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69106
1388