How to use the ftruncateAsync function from fs

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

84
85
86
87
88
89
90
91
92
93
94
      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

+ 2 other calls in file