You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

get-stream

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.0 to 6.0.0

3

index.d.ts

@@ -103,7 +103,4 @@ /// <reference types="node"/>

MaxBufferError: typeof MaxBufferErrorClass;
// TODO: Remove this for the next major release
default: typeof getStream;
};
export = getStream;

23

index.js
'use strict';
const {constants: BufferConstants} = require('buffer');
const pump = require('pump');
const stream = require('stream');
const {promisify} = require('util');
const bufferStream = require('./buffer-stream');
const streamPipelinePromisified = promisify(stream.pipeline);
class MaxBufferError extends Error {

@@ -15,3 +18,3 @@ constructor() {

if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
throw new Error('Expected a stream');
}

@@ -25,4 +28,4 @@

const {maxBuffer} = options;
const stream = bufferStream(options);
let stream;
await new Promise((resolve, reject) => {

@@ -38,11 +41,11 @@ const rejectPromise = error => {

stream = pump(inputStream, bufferStream(options), error => {
if (error) {
(async () => {
try {
await streamPipelinePromisified(inputStream, stream);
resolve();
} catch (error) {
rejectPromise(error);
return;
}
})();
resolve();
});
stream.on('data', () => {

@@ -59,6 +62,4 @@ if (stream.getBufferedLength() > maxBuffer) {

module.exports = getStream;
// TODO: Remove this for the next major release
module.exports.default = getStream;
module.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
module.exports.array = (stream, options) => getStream(stream, {...options, array: true});
module.exports.MaxBufferError = MaxBufferError;
{
"name": "get-stream",
"version": "5.2.0",
"version": "6.0.0",
"description": "Get a stream as a string, buffer, or array",

@@ -14,3 +14,3 @@ "license": "MIT",

"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -41,12 +41,9 @@ "scripts": {

],
"dependencies": {
"pump": "^3.0.0"
},
"devDependencies": {
"@types/node": "^12.0.7",
"ava": "^2.0.0",
"@types/node": "^14.0.27",
"ava": "^2.4.0",
"into-stream": "^5.0.0",
"tsd": "^0.7.2",
"tsd": "^0.13.1",
"xo": "^0.24.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc