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

passthrough-counter

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passthrough-counter

Get the total buffer length of a stream.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
525K
increased by27.74%
Maintainers
2
Weekly downloads
 
Created

What is passthrough-counter?

The passthrough-counter npm package is a simple utility that acts as a pass-through stream while counting the number of bytes that pass through it. It is useful in scenarios where you need to monitor the amount of data being processed in a stream pipeline.

What are passthrough-counter's main functionalities?

Counting Bytes in a Stream

This feature allows you to count the number of bytes that pass through a stream. In this example, data from 'input.txt' is read, passed through the counter, and written to 'output.txt'. The total number of bytes is logged once the stream finishes.

const PassThroughCounter = require('passthrough-counter');
const fs = require('fs');

const counter = new PassThroughCounter();

fs.createReadStream('input.txt')
  .pipe(counter)
  .pipe(fs.createWriteStream('output.txt'))
  .on('finish', () => {
    console.log(`Total bytes: ${counter.length}`);
  });

Other packages similar to passthrough-counter

Keywords

FAQs

Package last updated on 07 Dec 2014

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