Socket
Socket
Sign inDemoInstall

read-chunk

Package Overview
Dependencies
0
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
3.06 kB
Created

Readme

Source

read-chunk Build Status

Read a chunk from a file

Because the built-in way is too much boilerplate.

Install

$ npm install --save read-chunk

Usage

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

// foo.txt => hello

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

API

readChunk(filepath, position, length, callback)

filepath

Type: string

position

Type: number

Position to start reading.

length

Type: number

Number of bytes to read.

callback(error, buffer)

Type: function

readChunk.sync(filepath, start, length)

Same arguments as readChunk except the callback.

Returns a buffer.

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 17 Jan 2015

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