How to use the ftruncateSync function from graceful-fs

Find comprehensive JavaScript graceful-fs.ftruncateSync code examples handpicked from public code repositorys.

143
144
145
146
147
148
149
150
151
if (!posix.acquireRecordLock(fd, F_WRLCK, SEEK_SET, 0, 0)) {
  return false;
}

var buf = Buffer.from(process.pid + '', 'ascii');
fs.ftruncateSync(fd, 0);
var pos = 0;
while (pos < buf.length)
  pos += fs.writeSync(fd, buf, pos, buf.length - pos, pos);
fork icon291
star icon672
watch icon0

529
530
531
532
533
534
535
536
537
538
539
540


// truncate
exports.truncate = Promise.promisify(fs.truncate);
exports.truncateSync = fs.truncateSync;
exports.ftruncate = Promise.promisify(fs.ftruncate);
exports.ftruncateSync = fs.ftruncateSync;


// unlink
exports.unlink = Promise.promisify(fs.unlink);
exports.unlinkSync = fs.unlinkSync;
fork icon9
star icon48
watch icon0

+ 7 other calls in file