Node stream storage
Simple duplex streams for cache large data in memory and files.
npm install stream-storage --save
Usage
const { StreamStorage } = require('stream-storage');
const streamStorage = new StreamStorage();
streamStorage.destroy();
stream-storage
StreamStorage extends the standard stream.Duplex interface. All writes data to this stream will accumulate in internal Buffer. If the internal buffer overflows it will be resized automatically. The initial size of the Buffer and the amount in which it grows can be configured in the constructor. Data exceeding the maxSize of the size will be saved to a file.
You can change default options:
const streamStorage = new StreamStorage({
initialSize: (8 * 1024),
incrementAmount: (16 * 1024),
maxSize: (32 * 1024),
tmpDir: '.',
chunkSize: (8 * 1024)
});
Contributors
Thanks to the node-stream-buffer for inspiration!
dev
test
For run test:
npm run test
versions
- 0.0.1 - init
- 0.0.2
- 0.0.3
- 0.0.4
- 0.0.5 - fix pause