 <p>It is possible to inherit from <code>stream.Stream</code> and make it work, however based on what's available in the <a href="https://nodejs.org/api/stream.html" rel="nofollow">documentation</a> I would suggest inheriting from <a href="https://nodejs.org/api/stream.html#stream_class_stream_writable_1" rel="nofollow"><code>stream.Writable</code></a>. Piping into a <code>stream.Writable</code> you'll need to have <a href="https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1" rel="nofollow"><code>_write(chunk, encoding, done)</code></a> defined to handle the piping. Here is an example:</p> <pre><code>var asset = new ProjectAsset('myFile', __dirname + '/image.jpg') var stream = fs.createReadStream(__dirname + '/image.jpg', { encoding: 'base64' }).pipe(asset) stream.on('finish', function() { console.log(asset.binaryData); }) </code></pre> <p>Project Asset</p> <pre><code>'use strict' var stream = require('stream'), util = require('util') var ProjectAsset = function() { var self = this self.data self.binaryData = []; stream.Writable.call(self) self._write = function(chunk, encoding, done) { // Can handle this data however you want self.binaryData.push(chunk.toString()) // Call after processing data done() } self.on('finish', function() { self.data = Buffer.concat(self.binaryData) }) return self } util.inherits(ProjectAsset, stream.Writable) module.exports = ProjectAsset module.exports.DEFAULT_FILE_NAME = 'file' </code></pre> <p>If you're looking to also read from the <code>stream</code>, take a look at inheriting from <a href="https://nodejs.org/api/stream.html#stream_class_stream_duplex_1" rel="nofollow"><code>stream.Duplex</code></a> and also including the <a href="https://nodejs.org/api/stream.html#stream_readable_read_size_1" rel="nofollow"><code>_read(size)</code></a> method.</p> <p>There's also the <a href="https://nodejs.org/api/stream.html#stream_simplified_constructor_api" rel="nofollow">simplified constructors api</a> if you're doing something simpler.</p>