Socket
Book a DemoInstallSign in
Socket

limit-size-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

limit-size-stream

Limit the size of a stream

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

limit-size-stream Build Status

Limit the size of a stream

Install

$ npm install --save limit-size-stream

Usage

const fs = require('fs');
const getStream = require('get-stream');
const limitSizeStream = require('limit-size-stream');
const stream = fs.createReadStream('unicorn.txt');

getStream(limitStream(stream, 5)).then(str => {
	console.log(str);
	//=> 'unico'
});

API

limitSizeStream(stream, limit)

stream

Type: Stream

Stream to limit.

limit

Type: number

Maximum length of the returned buffer or string.

limitSizeStream.obj(stream, limit)

stream

Type: Stream

Stream to limit.

limit

Type: number

Maximum number of items to return.

License

MIT © Kevin Martensson

Keywords

limit

FAQs

Package last updated on 09 Mar 2017

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