Socket
Socket
Sign inDemoInstall

progress-stream

Package Overview
Dependencies
8
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

2

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

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

@@ -9,19 +9,49 @@ # progress-stream

This example reads 100 MB from stdin, and writes out the percentage every 100ms.
This example copies a large file, and prints out the percentage every 100ms.
```js
var progress = require('progress-stream');
var fs = require('fs');
p = progress({
time: 100,
length: 100000000
var stat = fs.statSync(filename);
var p = progress({
length: stat.size,
time: 100
});
p.on('progress', function(progress) {
console.log(progress.percentage);
console.log(Math.round(progress.percentage)+'%');
});
process.stdin.pipe();
fs.createReadStream(filename)
.pipe(p)
.pipe(fs.createWriteStream(output));
```
## Methods
# progress([options], [onprogress])
You can instantiate in two ways:
``` js
var p = progress({time:100});
p.on('progress', function(progress) { ... });
```
or inline the onprogress event
``` js
var p = progress({time:100}, function(progress) { ... });
```
## Events
# on('progress', onprogress)
``` js
var p = progress({time:100});
p.on('progress', function(progress) { ... });
```
## Options

@@ -50,3 +80,3 @@

``` js
var progress = require('progress-steram);
var progress = require('progress-stream');
var req = require('request');

@@ -53,0 +83,0 @@ var fs = require('fs');

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