read-slice

read part of a file

npm install read-slice
2 downloads in the last week
30 downloads in the last month

read-slice

read part of a file

Installation

With npm

$ npm install read-slice --save

then in your app:

var slice = require('read-slice')

API

slice(file:String, from:Number, to:Number)

read a portion of file. slice returns a Result though you can access the internal callback based implemenation as slice.plain

Example

the head(1) executable can be loosly emulated by defining head as

function head(file){
  slice(file, 0, 100).read(function(buffer){
    console.log(buffer.toString('utf8'))
  })
}

Running the tests

$ make test
npm loves you