Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rw-utf8-promise

adonespitogo5MIT1.0.1

Read and write to text files in utf8 format using promise API

write, read, utf8, promise, fs

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)
})

License

MIT License