Socket
Socket
Sign inDemoInstall

progress-stream

Package Overview
Dependencies
10
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.5.0

6

index.js

@@ -60,2 +60,8 @@ var through = require('through2');

};
// Expose `onlength()` handler as `setLength()` to support custom use cases where length
// is not known until after a few chunks have already been pumped, or is
// calculated on the fly.
tr.setLength = onlength;
tr.on('pipe', function(stream) {

@@ -62,0 +68,0 @@ // Support http module

2

package.json
{
"name": "progress-stream",
"version": "0.4.0",
"version": "0.5.0",
"description": "Read the progress of a stream",

@@ -5,0 +5,0 @@ "repository": {

@@ -144,1 +144,17 @@ # progress-stream

## Methods
### `setLength(newLength)`
Sometimes, you don't know how big a stream is right away (e.g. multipart file uploads). You might find out after a few chunks have already passed through the stream, seconds or even minutes later. In this case, you can use the `setLength` method to recalculate the relevant tracked progress data.
```js
var str = progress({});
someFickleStreamInstance.pipe(str).pipe(fs.createWriteStream('test.data'));
someFickleStreamInstance.on('conviction', function nowIKnowMyLength (actualLength) {
str.setLength(actualLength);
});
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc