read part of a file
With npm
$ npm install read-slice --save
then in your app:
var slice = require('read-slice')
read a portion of file
. slice
returns a Result though you can access the internal callback based implemenation as slice.plain
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'))
})
}
$ make test