Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to stream to concat-stream #14

Closed
andrewspy opened this issue Jan 10, 2017 · 3 comments
Closed

Unable to stream to concat-stream #14

andrewspy opened this issue Jan 10, 2017 · 3 comments
Assignees
Labels

Comments

@andrewspy
Copy link

andrewspy commented Jan 10, 2017

I intend to output the stream to string using concat-stream instead of writing to file system, but it doesn't seems to work. below is the sample code:-

let concat = require('concat-stream');

...
.then(streamResult => {
    // using the length property you can do things like
    // directly upload the image to s3 by using the
    // stream and length properties
    streamResult.stream // => Stream object
    streamResult.length // => Integer length of stream
    
    let imgStr = '';
    let cs = concat(buffer => {
      imgStr = buffer.toString('base64');

      console.log(imgStr);
    });
      
    streamResult.stream.pipe(cs);
    
    // write to a file
    // return chartNode.writeImageToFile('image/png', './testimage.png');
})
.then(() => {
    // chart is now written to the file path
    // ./testimage.png
});

I am new to javascript and stream, and hope someone can give me a pointer. Thanks!

@sedouard sedouard added the bug label Jan 10, 2017
@sedouard sedouard self-assigned this Jan 10, 2017
@sedouard
Copy link
Contributor

Thanks for reporting this @andrewspy looks like we aren't closing the ReadableStream we're providing you. PR #15 will fix this. I'll have a new package out shortly.

@sedouard
Copy link
Contributor

Closed via #15. published [email protected] with this fix. Cheers! 🍻

@andrewspy
Copy link
Author

@sedouard Confirming the issue is fixed.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants