I have implemented Huffman's algorithm in Node JS and it looks like this:
huffman.encode(inputFilename, outputFilename)
huffman.decode(inputFilename, outputFilename)
But I want to implement it like this:
inputStream.pipe(HuffmanEncoderStream).pipe(outputStream)
outputStream.pipe(HuffmanDecoderStream).pipe(inputStream)
And the problem is I need to read content of the source file twice. Firstly to create table of frequencies and Huffman's tree and secondary to exactly encode content. So is it possible to implement this task with Transform Stream?
P.S. with decoding there no problems