How to use the readFile function from graceful-fs

Find comprehensive JavaScript graceful-fs.readFile code examples handpicked from public code repositorys.

79
80
81
82
83
84
85
86
87
88
}

var client = this
fs.stat(cachePath, function (er, stat) {
  if (!er) {
    fs.readFile(cachePath, function (er, data) {
      data = parseJSON.noExceptions(data)

      params.stat = stat
      params.data = data
fork icon0
star icon1
watch icon1

+ 14 other calls in file

70
71
72
73
74
75
76
77
78
79
var which = npm.config.get('global') ? 'global' : 'user'
var f = npm.config.get(which + 'config')
if (!e) return cb(new Error('No EDITOR config or environ set.'))
npm.config.save(which, function (er) {
  if (er) return cb(er)
  fs.readFile(f, 'utf8', function (er, data) {
    if (er) data = ''
    data = [
      ';;;;',
      '; npm ' + (npm.config.get('global')
fork icon0
star icon1
watch icon1

+ 2 other calls in file

60
61
62
63
64
65
66
67
68
69
// verify file exists already
assert(fs.existsSync(dest))

fse.move(src, dest, { overwrite: true }, err => {
  assert.ifError(err)
  fs.readFile(dest, 'utf8', (err, contents) => {
    const expected = /^sonic the hedgehog\r?\n$/
    assert.ifError(err)
    assert.ok(contents.match(expected))
    done()
fork icon802
star icon0
watch icon91

+ 19 other calls in file