1.1.1 • Published 5 years ago

file-handler-sync v1.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

File Handler

file-handler-sync can synchronously read and write files by line

Install

Using npm:

$ npm install file-handler-sync

Using yarn:

$ yarn add file-handler-sync

Usage

const handler = require('file-handler-sync')

let reader = handler.read('example/input.txt', {
  bufferSize: 1024 * 1024, // 1M Default
  encoding: 'utf8' // Default
})
let writer = handler.write('example/output.txt', {
  cacheLines: 1000 // Cache some lines before writing to the file
})
for (let line of reader) {
  writer.writeLine(line)
}
writer.close()