Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

read-chunk

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-chunk

Read a chunk from a file

latest
Source
npmnpm
Version
5.0.0
Version published
Weekly downloads
643K
-2.48%
Maintainers
0
Weekly downloads
 
Created
Source

read-chunk

Read a chunk from a file

Because the built-in way requires way too much boilerplate.

Install

npm install read-chunk

Usage

import {readChunk} from 'read-chunk';

// foo.txt => hello

await readChunk('foo.txt', {length: 3, startPosition: 1});
//=> 'ell'

API

readChunk(filePath, {length, startPosition})

Returns a Promise<Uint8Array> with the read chunk.

readChunkSync(filePath, {length, startPosition})

Returns a Uint8Array with the read chunk.

filePath

Type: string

length

Type: number

The number of bytes to read.

startPosition

Type: number

The position to start reading from.

Keywords

read

FAQs

Package last updated on 28 Jun 2024

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