Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

minipass-sized

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Issues
File Explorer

Advanced tools

minipass-sized

A Minipass stream that raises an error if you get a different number of bytes than expected

    1.0.3latest

Version published
Maintainers
1
Weekly downloads
6,225,999
decreased by-12.01%

Weekly downloads

Readme

Source

minipass-sized

A Minipass stream that raises an error if you get a different number of bytes than expected.

USAGE

Use just like any old minipass stream, but provide a size option to the constructor.

The size option must be a positive integer, smaller than Number.MAX_SAFE_INTEGER.

const MinipassSized = require('minipass-sized') // figure out how much data you expect to get const expectedSize = +headers['content-length'] const stream = new MinipassSized({ size: expectedSize }) stream.on('error', er => { // if it's the wrong size, then this will raise an error with // { found: <number>, expect: <number>, code: 'EBADSIZE' } }) response.pipe(stream)

Caveats: this does not work with objectMode streams, and will throw a TypeError from the constructor if the size argument is missing or invalid.

Keywords

FAQs

What is minipass-sized?

A Minipass stream that raises an error if you get a different number of bytes than expected

Is minipass-sized popular?

The npm package minipass-sized receives a total of 5,019,883 weekly downloads. As such, minipass-sized popularity was classified as popular.

Is minipass-sized well maintained?

We found that minipass-sized demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 30 Sep 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc