1.0.0 • Published 9 years ago

buffer-file-stream v1.0.0

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
9 years ago

buffer-file-stream

Write each buffer chunk to an individual file with an incrementing file name.

Useful for dumping an upstream stream to a series of files.

build status

Installation

This module is installed via npm:

$ npm install buffer-file-stream

Example Usage

Write all new Buffer data chunks to incrementing files:

var bufferFileStream = require('buffer-file-stream');

// writes all Buffer 'data' chunks to blah-000.txt, blah-001.txt, etc
// uses sprintf syntax for pattern

var bfs = bufferFileStream('/tmp/blah-%03d.txt');

bfs.write('hello');
// creates a text file /tmp/blah-000.txt with the text 'hello'

bfs.write('world');
// creates a text file /tmp/blah-001.txt with the text 'world'