How to use the _toUnixTimestamp function from fs

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

43
44
45
46
47
48
49
50
51
52
53
  fs.fsyncSync(resource);
  return fs.fstatSync(resource);
}


function check_mtime(resource, mtime, statSync) {
  mtime = fs._toUnixTimestamp(mtime);
  const stats = stat_resource(resource, statSync);
  const real_mtime = fs._toUnixTimestamp(stats.mtime);
  return mtime - real_mtime;
}
fork icon42
star icon19
watch icon0

+ 3 other calls in file

3
4
5
6
7
8
9
10
11
12
13
const fs = require('fs');


[Infinity, -Infinity, NaN].forEach((input) => {
  assert.throws(
    () => {
      fs._toUnixTimestamp(input);
    },
    {
      code: 'ERR_INVALID_ARG_TYPE',
      name: 'TypeError'
fork icon42
star icon19
watch icon0

+ 5 other calls in file

37
38
39
40
41
42
43
44
45
46
47
    return fs.fstatSync(resource);
  }
}


function check_mtime(resource, mtime) {
  var mtime = fs._toUnixTimestamp(mtime);
  var stats = stat_resource(resource);
  var real_mtime = fs._toUnixTimestamp(stats.mtime);
  // check up to single-second precision
  // sub-second precision is OS and fs dependant
fork icon0
star icon0
watch icon0