1.0.3 • Published 7 years ago

file-read v1.0.3

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

file-read

Read file with specified size from head or tail.

Usage

const readFile = require('file-read')
const options = {
  /*
    `b` for bytes
    `kb` for kilobytes
    `mb` for megabytes
    `gb` for gigabytes
    `tb` for terabytes
  */
  size: '10', // decide how many bytes read from file. can be 10, 10kb, 10mb, 10gb and 10tb, refer to bytes lib.
  flag: 'r', // default is r,
  encoding: 'utf8', // default is utf8.
  tail: false // read file from tail or head.
}

console.log(readFile)
readFile('_yourFilePath_', options, function (err, data) {
  if (err) {
    console.error(err)
    return
  }
  console.log(data)
})

TODO

  • Finish unit test.
  • Add Promise.
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago