Garbage Collected block write stream
Install via npm
$ npm install --save block-write-stream
If run in a node process with --expose-gc
enabled, it will trigger GC mark & sweep and scavenge
every couple of writes to avoid the Buffers not being GCed in a timely manner, greatly reducing memory consumption.
For details, see https://github.com/nodejs/node/issues/6078.
var BlockWriteStream = require('block-write-stream')
var writeStream = new BlockWriteStream({
path: '/dev/rdisk2',
flags: 'w',
})