Socket
Book a DemoInstallSign in
Socket

disk-buffer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disk-buffer

Disk buffer

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

disk-buffer

Disk buffer as a writable stream, which after n bytes written and/or m writes finishes the file, emits an event and starts writing to a new one.

Example

var DiskBuffer = require('disk-buffer');

var b = new DiskBuffer('/tmp/artifacts', {
  flushBytes: 1024,
  flushWrites: 20
});

b.on('flush', function(flush){
  // do something with the file at
  // `flush.path`
});

someData().pipe(b);

Installation

$ npm install disk-buffer

API

DiskBuffer(path, opts)

Create a new DiskBuffer. The path given is used for the base of the filenames created, which append ".{pid}.{id}.{fid}".

Options:

  • .flushBytes: flush after this many bytes written
  • .flushWrites: flush after this many writes

Kudos

This is inspired by tj/go-disk-buffer.

License

MIT

FAQs

Package last updated on 26 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts