rw-utf8-promise
v1.0.1
Published
Read and write to text files in utf8 format using promise API
Downloads
4
Readme
Installation
npm i --save rw-utf8-promise
Usage
Read a file:
const rw = require('rw-utf8-promise')
var file_path = '/etc/hostname'
rw.read(file_path)
.then(function (hostname) {
console.log(hostname)
})
.catch(function (err) {
console.log(err)
})
Write to a file:
const rw = require('rw-utf8-promise')
var file_path = '/etc/hostname'
var new_hostname = 'archlinux-guy'
rw.write(file_path, new_hostname)
.then(function (hostname) {
console.log(hostname)
})
.catch(function (err) {
console.log(err)
})