read-slice

0.2.5 • Public • Published

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

/read-slice/

    Package Sidebar

    Install

    npm i read-slice

    Weekly Downloads

    12

    Version

    0.2.5

    License

    none

    Last publish

    Collaborators

    • jkroso