1.0.0 • Published 7 years ago

fs-read-exactly v1.0.0

Weekly downloads
71
License
MIT
Repository
github
Last release
7 years ago

fs-read-exactly

Read exactly n bytes of an fd or file

npm status node Travis build status AppVeyor build status Dependency status

example

const readExactly = require('fs-read-exactly')

readExactly('readme.md', 0, 15, function (err, chunk) {
  console.log(err) // null
  console.log(chunk.toString()) // '# fs-read-exact'
})

readExactly('readme.md', 0, 1e4, function (err, chunk) {
  console.log(err.code) // 'EOF'
})

readExactly(mixed, pos, length, callback)

Where mixed is either a filename or a file descriptor.

install

With npm do:

npm install fs-read-exactly

license

MIT © Vincent Weevers