How to use the _fstat function from fs

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

31
32
33
34
35
36
37
38
39
40
41
// sometimes stat returns size=0, but it's a lie.
fs._fstat = fs.fstat;
fs._fstatSync = fs.fstatSync;


fs.fstat = (fd, cb) => {
  fs._fstat(fd, (er, st) => {
    if (er) return cb(er);
    st.size = 0;
    return cb(er, st);
  });
fork icon0
star icon1
watch icon0

27
28
29
30
31
32
33
34
35
36
37
// sometimes stat returns size=0, but it's a lie.
fs._fstat = fs.fstat;
fs._fstatSync = fs.fstatSync;


fs.fstat = function(fd, cb) {
  fs._fstat(fd, function(er, st) {
    if (er) return cb(er);
    st.size = 0;
    return cb(er, st);
  });
fork icon3
star icon0
watch icon0