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
Post a Comment