How to use the ftruncateAsync function from fs
Find comprehensive JavaScript fs.ftruncateAsync code examples handpicked from public code repositorys.
GitHub: wisnuc/appifi
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) } }
28
63
0
+ 2 other calls in file
fs.readFileSync is the most popular function in fs (2736 examples)