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

stream-progressbar

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-progressbar - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

test/fs.js

24

index.js

@@ -5,15 +5,25 @@ var PassThrough = require('stream').PassThrough;

module.exports = function(tokens, options) {
var pt = new PassThrough();
options = options || {};
var pt = new PassThrough();
var total = options.total;
pt.on('pipe', function(stream) {
stream.on('response', function(res) {
var total = parseInt(res.headers['content-length'], 10);
options.total = total;
var bar = new ProgressBar(tokens, options);
var bar = new ProgressBar(tokens, options);
if(total) {
pt.on('data', function(chunk) {
bar.tick(chunk.length);
});
});
} else {
stream.on('response', function(res) {
var total = parseInt(res.headers['content-length'], 10);
options.total = total;
var bar = new ProgressBar(tokens, options);
pt.on('data', function(chunk) {
bar.tick(chunk.length);
});
});
}
});

@@ -20,0 +30,0 @@

{
"name": "stream-progressbar",
"version": "0.0.1",
"version": "1.0.0",
"description": "Simple progress bar for node stream",

@@ -5,0 +5,0 @@ "main": "index.js",

# stream-progressbar
Simple progress bar for node stream
Simple progress bar for node stream with [progress](https://www.npmjs.com/package/progress)
``` sh

@@ -8,9 +8,11 @@ npm install stream-progressbar

``` javascript
var fs = require('fs');
var request = require('request');
var progress = require('stream-progressbar');
var request = require('request');
request('http://cachefly.cachefly.net/10mb.test').pipe(progress(':bar'));
request('http://cachefly.cachefly.net/10mb.test')
.pipe(progress(':bar'))
.pipe(fs.createWriteStream('10mb.test'));
```
**Notice:** This module only supports request stream now.
#### License
MIT
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