Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/chunked-stream-reader-node

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/chunked-stream-reader-node - npm Package Compare versions

Comparing version 3.183.0 to 3.186.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
**Note:** Version bump only for package @aws-sdk/chunked-stream-reader-node
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)

@@ -8,0 +16,0 @@

19

dist-es/index.js

@@ -1,8 +0,9 @@

export function streamReader(stream, onChunk, chunkSize = 1048576) {
return new Promise((resolve, reject) => {
let temporaryBuffer;
export function streamReader(stream, onChunk, chunkSize) {
if (chunkSize === void 0) { chunkSize = 1048576; }
return new Promise(function (resolve, reject) {
var temporaryBuffer;
stream.on("error", reject);
stream.on("end", () => {
if (temporaryBuffer?.byteLength) {
for (let i = 0; i < temporaryBuffer.byteLength; i += chunkSize) {
stream.on("end", function () {
if (temporaryBuffer === null || temporaryBuffer === void 0 ? void 0 : temporaryBuffer.byteLength) {
for (var i = 0; i < temporaryBuffer.byteLength; i += chunkSize) {
onChunk(temporaryBuffer.subarray(i, Math.min(i + chunkSize, temporaryBuffer.byteLength)));

@@ -14,3 +15,3 @@ }

});
stream.on("data", (chunk) => {
stream.on("data", function (chunk) {
if (!temporaryBuffer) {

@@ -22,3 +23,3 @@ temporaryBuffer = chunk;

}
let pointer = 0;
var pointer = 0;
while (temporaryBuffer.byteLength - pointer >= chunkSize) {

@@ -34,3 +35,3 @@ onChunk(temporaryBuffer.subarray(pointer, pointer + chunkSize));

function mergeUint8Arrays(a, b) {
const result = new Uint8Array(a.byteLength + b.byteLength);
var result = new Uint8Array(a.byteLength + b.byteLength);
result.set(a);

@@ -37,0 +38,0 @@ result.set(b, a.byteLength);

@@ -0,10 +1,13 @@

import { __extends } from "tslib";
import { Readable } from "stream";
export class ReadFromBuffers extends Readable {
constructor(options) {
super(options);
this.numBuffersRead = 0;
this.buffersToRead = options.buffers;
this.errorAfter = typeof options.errorAfter === "number" ? options.errorAfter : -1;
var ReadFromBuffers = (function (_super) {
__extends(ReadFromBuffers, _super);
function ReadFromBuffers(options) {
var _this = _super.call(this, options) || this;
_this.numBuffersRead = 0;
_this.buffersToRead = options.buffers;
_this.errorAfter = typeof options.errorAfter === "number" ? options.errorAfter : -1;
return _this;
}
_read() {
ReadFromBuffers.prototype._read = function () {
if (this.errorAfter !== -1 && this.errorAfter === this.numBuffersRead) {

@@ -18,3 +21,5 @@ this.emit("error", new Error("Mock Error"));

return this.push(this.buffersToRead[this.numBuffersRead++]);
}
}
};
return ReadFromBuffers;
}(Readable));
export { ReadFromBuffers };
{
"name": "@aws-sdk/chunked-stream-reader-node",
"version": "3.183.0",
"version": "3.186.0",
"scripts": {

@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc