Gathering detailed insights and metrics for progress-stream
Gathering detailed insights and metrics for progress-stream
Gathering detailed insights and metrics for progress-stream
Gathering detailed insights and metrics for progress-stream
@types/progress-stream
TypeScript definitions for progress-stream
ffmpeg-progress-stream
Generate a stream of progress events from the stderr stream of ffmpeg
show-stream-progress
Shows progress of any async operation that streams results.
stream-progressbar
Simple progress bar for node stream
npm install progress-stream
Typescript
Module System
Node Version
NPM Version
98.7
Supply Chain
99.4
Quality
74.4
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
159,462,213
Last Day
39,801
Last Week
583,864
Last Month
2,480,614
Last Year
26,249,048
BSD-2-Clause License
234 Stars
49 Commits
33 Forks
3 Watchers
1 Branches
8 Contributors
Updated on Aug 30, 2024
Minified
Minified + Gzipped
Latest Version
2.0.0
Package Id
progress-stream@2.0.0
Size
3.80 kB
NPM Version
3.10.3
Node Version
6.4.0
Published on
Apr 11, 2017
Cumulative downloads
Total Downloads
Last Day
9%
39,801
Compared to previous day
Last Week
-2%
583,864
Compared to previous week
Last Month
-0.9%
2,480,614
Compared to previous month
Last Year
31.5%
26,249,048
Compared to previous year
2
3
Read the progress of a stream. Supports speed and eta.
Gets the length of the stream automatically if you're using the request or http module. You can also pass the length on initiation. Progress-stream will also check to see if the stream already has a length property.
npm install progress-stream
This example copies a large file, and prints out the percentage, speed and remaining every 100ms.
1var progress = require('progress-stream'); 2var fs = require('fs'); 3 4var stat = fs.statSync(filename); 5var str = progress({ 6 length: stat.size, 7 time: 100 /* ms */ 8}); 9 10str.on('progress', function(progress) { 11 console.log(progress); 12 13 /* 14 { 15 percentage: 9.05, 16 transferred: 949624, 17 length: 10485760, 18 remaining: 9536136, 19 eta: 42, 20 runtime: 3, 21 delta: 295396, 22 speed: 949624 23 } 24 */ 25}); 26 27fs.createReadStream(filename) 28 .pipe(str) 29 .pipe(fs.createWriteStream(output));
You can instantiate in two ways:
1var str = progress({time:100}); 2str.on('progress', function(progress) { ... });
or inline the progress listener
1var str = progress({time:100}, function(progress) { ... });
You can get the progress from the progress function.
1var str = progress({time:100}); 2 3console.log(str.progress()); 4 5/* 6{ 7 percentage: 9.05, 8 transferred: 949624, 9 length: 10485760, 10 remaining: 9536136, 11 eta: 10, 12 runtime: 0, 13 delta: 295396, 14 speed: 949624 15} 16*/
1var str = progress({time:100}); 2str.on('progress', function(progress) { ... });
Sets how often progress events are emitted in ms. If omitted then the default is to do so every time a chunk is received.
Sets how long the speedometer needs to calculate the speed. Defaults to 5 sec.
If you already know the length of the stream, then you can set it. Defaults to 0.
In case you don't want to include a readstream after progress-stream, set to true to drain automatically. Defaults to false.
If you want to set the size of previously downloaded data. Useful for a resumed download.
This example uses request to download a 100 MB file, and writes out the percentage every second.
You can also find an example in test/request.js
.
1var progress = require('progress-stream'); 2var req = require('request'); 3var fs = require('fs'); 4 5var str = progress({ 6 time: 1000 7}); 8 9str.on('progress', function(progress) { 10 console.log(Math.round(progress.percentage)+'%'); 11}); 12 13req('http://cachefly.cachefly.net/100mb.test', { headers: { 'user-agent': 'test' }}) 14 .pipe(str) 15 .pipe(fs.createWriteStream('test.data'));
In test/http.js
it's shown how to do it with the http module.
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.
1var str = progress({}); 2someFickleStreamInstance.pipe(str).pipe(fs.createWriteStream('test.data')); 3 4someFickleStreamInstance.on('conviction', function nowIKnowMyLength (actualLength) { 5 str.setLength(actualLength); 6});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 7/29 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-19
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More