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

@dnlup/cut

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnlup/cut

A stream size validator

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

cut

A stream size validator

  • Installation
  • Usage
  • API

Installation

$ npm i @dnlup/cut

Usage

const cut = require('@dnlup/cut')
const { pipeline } = require('stream')

const readable = getReadableSomeHow()

pipeline([
  readable,
  cut() // Default max size is 1024 * 1024 bytes
  // ...Other streams in the pipeline here
], error => {
  if (error) {
    if (error.message === 'Maximum size reached') {
      console.error('File exceeded size limit')
    }
  }
})

API

cut([options])

create a new validator

  • options: Object. Configuration options.
    • options.size: Number. The maximum number of bytes that are allowed to flow in the stream.
    • options.*: See stream.Transform options.

Keywords

FAQs

Package last updated on 17 Feb 2020

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