Socket
Book a DemoInstallSign in
Socket

first-chunk-min-size-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

first-chunk-min-size-stream

Set the minimum size of the first chunk in a stream

latest
Source
npmnpm
Version
3.0.0
Version published
Maintainers
1
Created
Source

first-chunk-min-size-stream

Set the minimum size of the first chunk in a stream

Useful if you want to do something to the first chunk and need it to be of a certain size.

Install

$ npm install first-chunk-min-size-stream

Usage

import fs from 'node:fs';
import FirstChunkMinSize from 'first-chunk-min-size-stream';

fs.createReadStream('unicorn.txt', {highWaterMark: 1}) // `highWaterMark: 1` means it will only read 1 byte at the time
	.pipe(new FirstChunkMinSize({minSize: 7}))
	.once('data', data => {
		console.log(data.length);
		//=> 7
	});

API

firstChunkMinSize(options)

options

Type: object

minSize

Required
Type: number

The minimum size of the first chunk.

Keywords

buffer

FAQs

Package last updated on 03 May 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