@nbsh/writables
Useful implementations for writable stream
Last updated 7 years ago by rannn505 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @nbsh/writables 
SYNC missed versions from official npm registry.

writables

Useful implementations for writable stream

Installation

$ npm i -S @nbsh/writables
$ yarn add @nbsh/writables

Usage

import { createReadStream } from 'fs';
import { once } from 'events';
import { AccumulateStream, RotateStream, DomainStream, DOMAIN_EVENT, ROTATE_EVENT } from '@nbsh/writables';

(async (): void => {
  // file.txt: (2kb)
  // @nbsh/writables
  // streams are awesome. streams are awesome.
  // streams are awesome. streams are awesome.
  // ... ...
  // @nbsh/writables
  const readable = createReadStream('file.txt');

  const acc = new AccumulateStream();
  const rot = new RotateStream({ size: '1kb', count: 2 });
  const dom = new DomainStream('@nbsh/writables');

  readable.pipe(acc);
  readable.pipe(rot);
  readable.pipe(dom);

  // will be emitted every 1kb and 2 writes
  rot.on(ROTATE_EVENT, () => console.log(rot.getContent().toString()));

  // will be emitted when '@nbsh/writables' written for the second time
  await once(dom, DOMAIN_EVENT);

  console.log(acc.getContent().toString());
})();

[TBD]: API

Current Tags

  • 5.0.0-next.1                                ...           latest (7 years ago)
  • 5.0.0-next.1                                ...           next (7 years ago)

1 Versions

  • 5.0.0-next.1                                ...           7 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (4)
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE