sindresorhus / get-stream

Get a stream as a string, Buffer, ArrayBuffer or array
MIT License
341 stars 33 forks source link

resolve not firing when downloading big files #16

Closed sheerun closed 8 years ago

sheerun commented 8 years ago

Related: https://github.com/kevva/download/issues/105

How to reproduce: https://github.com/sheerun/async-fail/

jamestalmage commented 8 years ago

This appears to be unrelated to get-stream:

Attempted reproduction:

var http = require('https');
var getStream = require('get-stream');

http.get('https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x86.tar.xz')
    .on('response', resp => {
        getStream(resp).then(data => console.log(`got the data: ${data.length}`));
    });

Result:

got the data: 7634317
jamestalmage commented 8 years ago

It also works just fine using got directly:

var got = require('got');
var getStream = require('./');
var url = 'https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x86.tar.xz';

getStream.buffer(got.stream(url))
    .then(res => {
        console.log('result :' + res.length);
    });

@kevva - I'm pretty sure https://github.com/sindresorhus/get-stream/pull/6 is what broke things for the download package, but moving to flowing mode was a conscious decision. I've looked at your code, and nothing is jumping out at me as wrong.

jamestalmage commented 8 years ago

See https://github.com/kevva/download/pull/108

kevva commented 8 years ago

Yeah, I tried concat-stream and got the same result so probably not related to this module.