Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accumulate-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accumulate-stream

Useful implementations for writable stream

  • 5.0.0-next.3
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.6K
decreased by-20.5%
Maintainers
1
Weekly downloads
 
Created
Source

accumulate-stream

Useful implementations for writable stream

Installation

$ npm i -S accumulate-stream
$ yarn add accumulate-stream

Usage

import { createReadStream } from 'fs';
import { once } from 'events';
import { AccumulateStream, RotateStream, DomainStream, DOMAIN_EVENT, ROTATE_EVENT } from 'accumulate-stream';

(async (): void => {
  // file.txt: (2kb)
  // accumulate-stream
  // streams are awesome. streams are awesome.
  // streams are awesome. streams are awesome.
  // ... ...
  // accumulate-stream
  const readable = createReadStream('file.txt');

  const acc = new AccumulateStream();
  const rot = new RotateStream({ size: '1kb', count: 2 });
  const dom = new DomainStream('accumulate-stream');

  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 'accumulate-stream' written for the second time
  await once(dom, DOMAIN_EVENT);

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

[TBD]: API

FAQs

Package last updated on 27 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc