Skip to content

Doesn't get the length of stream automatically using request. #26

@vibhor1997a

Description

@vibhor1997a

Given in the readme section

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.

I tried this example in the readme and length was 0(default value) not the length of the stream.

var progress = require('progress-stream');
var req = require('request');
var fs = require('fs');

var str = progress({
    time: 1000
});

str.on('progress', function (progress) {
    console.log(Math.round(progress.percentage) + '%');
});

req('http://cachefly.cachefly.net/100mb.test', { headers: { 'user-agent': 'test' } })
    .pipe(str)
    .pipe(fs.createWriteStream('test.data'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions