Node.js fs: detecting when outStream finishes writing -


i'm using node zlib.creategzip compress huge string.

using streams, following operation. know when outstream finished writing data can invoke callback. know how detect instream 'end' event can't find equivalent writable outstream.

any suggestions?

var gzoption = {     level: zlib.z_best_compression,      memlevel: zlib.z_best_compression } var gzip = zlib.creategzip(gzoption)  inputstream = fs.createreadstream(filepath); outstream = fs.createwritestream(gzfilepath); inputstream.pipe(gzip).pipe(outstream); 

did try listening finish event of writeable stream? it's documented here: https://nodejs.org/api/stream.html#stream_event_finish

when end() method has been called, , data has been flushed underlying system, event emitted.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -