Socket
Socket
Sign inDemoInstall

read-chunk

Package Overview
Dependencies
4
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
Maintainers
1
Install size
27.3 kB
Created

Readme

Source

read-chunk Build Status

Read a chunk from a file

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

Install

$ npm install read-chunk

Usage

const readChunk = require('read-chunk');

// foo.txt => hello

readChunk.sync('foo.txt', 1, 3);
//=> 'ell'

API

readChunk(filePath, startPosition, length)

Returns a Promise<Buffer> with the read chunk.

readChunk.sync(filePath, startPosition, length)

Returns a Buffer with the read chunk.

filePath

Type: string

startPosition

Type: number

Position to start reading.

length

Type: number

Number of bytes to read.

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 31 Mar 2019

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