How to use the read function from fs-extra

Find comprehensive JavaScript fs-extra.read code examples handpicked from public code repositorys.

1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
  resolve(null)
  return
}
const contentLength = 128
var buffer = Buffer.alloc(contentLength)
fs.read(fd, buffer, 0, contentLength, 0, function(err, num) {
  if(err) {
    resolve(null)
  } else {
    let data = buffer.toString('utf-8', 0, num) + (num >= contentLength ? "..." : "")
fork icon1
star icon1
watch icon1

+ 6 other calls in file

7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
  return new Promise(resolve => {
    return fs.exists(filename, resolve)
  })
}


// fs.read() & fs.write need special treatment due to multiple callback args


exports.read = function (fd, buffer, offset, length, position, callback) {
  if (typeof callback === 'function') {
    return fs.read(fd, buffer, offset, length, position, callback)
fork icon0
star icon1
watch icon0

+ 26 other calls in file

function icon

fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)