Socket
Socket
Sign inDemoInstall

stream-to-string

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-to-string - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

.jshintignore

19

index.d.ts

@@ -1,4 +0,17 @@

declare module 'stream-to-string' {
const streamToString: (stream: NodeJS.ReadableStream) => Promise<string>;
export = streamToString;
/// <reference types="node" />
export = streamToString;
declare function streamToString(
stream: NodeJS.ReadableStream,
cb?: streamToString.Callback
): Promise<string>;
declare function streamToString(
stream: NodeJS.ReadableStream,
enc: string,
cb?: streamToString.Callback
): Promise<string>;
declare namespace streamToString {
type Callback = (error: Error | undefined, str: string) => void;
}

13

index.js

@@ -8,7 +8,6 @@ var Promise = require('promise-polyfill')

}
cb = cb || function () {}
var str = ''
return new Promise (function (resolve, reject) {
var p = new Promise (function (resolve, reject) {
stream.on('data', function (data) {

@@ -19,9 +18,9 @@ str += (typeof enc === 'string') ? data.toString(enc) : data.toString()

resolve(str)
cb(null, str)
})
stream.on('error', function (err) {
reject(err)
cb(err)
})
stream.on('error', reject)
})
if (cb) {
p.then(function (str) { cb(null, str) }, cb)
}
return p
}
{
"name": "stream-to-string",
"version": "1.2.0",
"version": "1.2.1",
"description": "Pipe a stream into a string, collect value with callback or promise",

@@ -33,2 +33,3 @@ "main": "index.js",

"devDependencies": {
"@types/node": "*",
"istanbul": "~0.2.8",

@@ -39,7 +40,11 @@ "jshint": "^2.5.6",

"tape": "~4.0.1",
"through2": "^0.6.3"
"through2": "^0.6.3",
"tsd": "^0.25.0"
},
"dependencies": {
"promise-polyfill": "^1.1.6"
},
"tsd": {
"directory": "test"
}
}

Sorry, the diff of this file is not supported yet

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