How to use the writeAsync function from fs

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

137
138
139
140
141
142
143
144
145
146
let self = this

if (!(data instanceof Buffer))
  return Promise.reject(new Error('Invalid data'))

  return fs.writeAsync(this.fd, data, 0, data.length, this.pos)
    .then((bytes) => {
      self.bytesWritten += bytes

      if (self.pos !== undefined)
fork icon1
star icon1
watch icon0