@aws-sdk/chunked-stream-reader-node
Advanced tools
Comparing version 0.1.0-preview.3 to 0.1.0-preview.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function streamReader(stream, onChunk, chunkSize // 1 MiB | ||
function streamReader(stream, onChunk, chunkSize = 1048576 // 1 MiB | ||
) { | ||
if (chunkSize === void 0) { chunkSize = 1048576; } | ||
return new Promise(function (resolve, reject) { | ||
var temporaryBuffer; | ||
return new Promise((resolve, reject) => { | ||
let temporaryBuffer; | ||
stream.on("error", reject); | ||
stream.on("end", function () { | ||
stream.on("end", () => { | ||
if (temporaryBuffer && temporaryBuffer.byteLength) { | ||
for (var i = 0; i < temporaryBuffer.byteLength; i += chunkSize) { | ||
for (let i = 0; i < temporaryBuffer.byteLength; i += chunkSize) { | ||
onChunk(temporaryBuffer.subarray(i, Math.min(i + chunkSize, temporaryBuffer.byteLength))); | ||
@@ -19,3 +18,3 @@ } | ||
}); | ||
stream.on("data", function (chunk) { | ||
stream.on("data", (chunk) => { | ||
if (!temporaryBuffer) { | ||
@@ -27,3 +26,3 @@ temporaryBuffer = chunk; | ||
} | ||
var pointer = 0; | ||
let pointer = 0; | ||
while (temporaryBuffer.byteLength - pointer >= chunkSize) { | ||
@@ -41,3 +40,3 @@ onChunk(temporaryBuffer.subarray(pointer, pointer + chunkSize)); | ||
function mergeUint8Arrays(a, b) { | ||
var result = new Uint8Array(a.byteLength + b.byteLength); | ||
const result = new Uint8Array(a.byteLength + b.byteLength); | ||
result.set(a); | ||
@@ -44,0 +43,0 @@ result.set(b, a.byteLength); |
@@ -6,2 +6,27 @@ # Change Log | ||
# [0.1.0-preview.4](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/chunked-stream-reader-node@0.1.0-preview.1...@aws-sdk/chunked-stream-reader-node@0.1.0-preview.4) (2019-09-19) | ||
# 0.3.0 (2019-09-09) | ||
### Features | ||
* commit all clients ([#324](https://github.com/aws/aws-sdk-js-v3/issues/324)) ([cb268ed](https://github.com/aws/aws-sdk-js-v3/commit/cb268ed)) | ||
# 0.2.0 (2019-07-12) | ||
### Features | ||
* add npm badges for individual packages ([#251](https://github.com/aws/aws-sdk-js-v3/issues/251)) ([8adc10c](https://github.com/aws/aws-sdk-js-v3/commit/8adc10c)) | ||
* update jest v20 to v24 ([#243](https://github.com/aws/aws-sdk-js-v3/issues/243)) ([1e156ab](https://github.com/aws/aws-sdk-js-v3/commit/1e156ab)) | ||
# [0.1.0-preview.3](https://github.com/aws/aws-sdk-js-v3/compare/@aws-sdk/chunked-stream-reader-node@0.1.0-preview.1...@aws-sdk/chunked-stream-reader-node@0.1.0-preview.3) (2019-09-09) | ||
@@ -8,0 +33,0 @@ |
{ | ||
"name": "@aws-sdk/chunked-stream-reader-node", | ||
"version": "0.1.0-preview.3", | ||
"version": "0.1.0-preview.4", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "prepublishOnly": "tsc", |
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"target": "es2017", | ||
"module": "commonjs", | ||
@@ -11,9 +11,2 @@ "declaration": true, | ||
"noEmitHelpers": true, | ||
"lib": [ | ||
"es5", | ||
"es2015.promise", | ||
"es2015.collection", | ||
"es2015.iterable", | ||
"es2015.symbol.wellknown" | ||
], | ||
"rootDir": "./src", | ||
@@ -20,0 +13,0 @@ "outDir": "./build", |
Sorry, the diff of this file is not supported yet
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
18327
64