How to use the fsyncSync function from fs

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

48
49
50
51
52
53
54
55
56
57
exports.fdatasync = co.promisify(fs.fdatasync);
exports.fdatasyncSync = fs.fdatasyncSync;
exports.fstat = co.promisify(fs.fstat);
exports.fstatSync = fs.fstatSync;
exports.fsync = co.promisify(fs.fsync);
exports.fsyncSync = fs.fsyncSync;
exports.ftruncate = co.promisify(fs.ftruncate);
exports.ftruncateSync = fs.ftruncateSync;
exports.futimes = co.promisify(fs.futimes);
exports.futimesSync = fs.futimesSync;
fork icon22
star icon45
watch icon26

38
39
40
41
42
43
44
45
46
47
48
  const stats = fs.fstatSync(resource);
  // Ensure mtime has been written to disk
  // except for directories on AIX where it cannot be synced
  if (common.isAIX && stats.isDirectory())
    return stats;
  fs.fsyncSync(resource);
  return fs.fstatSync(resource);
}


function check_mtime(resource, mtime, statSync) {
fork icon42
star icon19
watch icon0

581
582
583
584
585
586
587
588
589
590
591
592


  common.runWithInvalidFD((fd) => {
    fs.fsync(fd, common.mustCall(validateError));


    assert.throws(
      () => fs.fsyncSync(fd),
      validateError
    );
  });
}
fork icon42
star icon19
watch icon0

35
36
37
38
39
40
41
42
43
44
45
46
47
fs.copyFileSync(fileFixture, fileTemp);


fs.open(fileTemp, 'a', 0o777, common.mustSucceed((fd) => {
  fs.fdatasyncSync(fd);


  fs.fsyncSync(fd);


  fs.fdatasync(fd, common.mustSucceed(() => {
    fs.fsync(fd, common.mustSucceed(() => {
      fs.closeSync(fd);
fork icon42
star icon19
watch icon0