How to use the fstatAsync function from fs

Find comprehensive JavaScript fs.fstatAsync code examples handpicked from public code repositorys.

82
83
84
85
86
87
88
89
90
91
    ioctl(dstFd, 0x40049409, srcFd)  
  } finally {
    await fs.closeAsync(srcFd)
  }

  let stat = await fs.fstatAsync(dstFd)
  if (stat.size < bytes) throw new Error('file does not have enough bytes to truncate')
  await fs.ftruncateAsync(dstFd, stat.size - bytes)
} finally {
  await fs.closeAsync(dstFd)
fork icon28
star icon63
watch icon0

+ 5 other calls in file

6
7
8
9
10
11
12
13
14
15
    callback(err, null);
}

fs.openAsync(filename, 'r')
    .then(function (fd) {
        fs.fstatAsync(fd)
            .then(function (stats) {
                if (stats.isFile()) {
                    var b = new Buffer(stats.size);
                    return fs.readAsync(fd, b, 0, stats.size, null)
fork icon1
star icon1
watch icon0

52
53
54
55
56
57
58
59
60
61
_openAsync() {
  let self = this
  return fs.openAsync(this.path, this.flags, this.mode)
    .then((fd) => {
      self.fd = fd
      return fs.fstatAsync(fd)
    })
    .then((stats) => {
      self.ino = stats.ino
    })
fork icon1
star icon1
watch icon0