Socket
Socket
Sign inDemoInstall

read-chunk

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    read-chunk

Read a chunk from a file


Version published
Weekly downloads
558K
decreased by-12.79%
Maintainers
1
Install size
13.2 kB
Created
Weekly downloads
 

Readme

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<Buffer> with the read chunk.

readChunkSync(filePath, {length, startPosition})

Returns a Buffer with the read chunk.

filePath

Type: string

length

Type: number

The number of bytes to read.

startPosition

Type: number

The poosition to start reading from.

Keywords

FAQs

Last updated on 28 Aug 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc