How to use the fstatSync function from graceful-fs

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

521
522
523
524
525
526
527
528
529
530
531
532


// stat
exports.stat = Promise.promisify(fs.stat);
exports.statSync = fs.statSync;
exports.fstat = Promise.promisify(fs.fstat);
exports.fstatSync = fs.fstatSync;
exports.lstat = Promise.promisify(fs.lstat);
exports.lstatSync = fs.lstatSync;


// truncate
fork icon9
star icon48
watch icon0

+ 7 other calls in file

63
64
65
66
67
68
69
70
71
72
const _buff = buffer(BUF_LENGTH)

const flags = overwrite ? 'w' : 'wx'

const fdr = fs.openSync(src, 'r')
const stat = fs.fstatSync(fdr)
const fdw = fs.openSync(dest, flags, stat.mode)
let pos = 0

while (pos < stat.size) {
fork icon0
star icon1
watch icon0

17
18
19
20
21
22
23
24
25
    throw err
  }
}

var fdr = fs.openSync(srcFile, 'r')
var stat = fs.fstatSync(fdr)
var fdw = fs.openSync(destFile, 'w', stat.mode)
var bytesRead = 1
var pos = 0
fork icon0
star icon0
watch icon0

18
19
20
21
22
23
24
25
26
27
28
29
function file_exists(path) {
	return fs.existsSync(path);
}


function file_size(fd) {
	return fs.fstatSync(fd).size;
}


function file_open(path) {
	return fs.openSync(path, "r+");
fork icon0
star icon0
watch icon0

82
83
84
85
86
87
88
89
90
91
92
	}
};


exports.fstatSync = (fileDescriptor, path) => {
	try {
		return fs.fstatSync(fileDescriptor);
	} catch (error) {
		throw new CpFileError(`fstat \`${path}\` failed: ${error.message}`, error);
	}
};
fork icon0
star icon0
watch icon0

82
83
84
85
86
87
88
89
90
91
92
	}
};


exports.fstatSync = (fd, path) => {
	try {
		return fs.fstatSync(fd);
	} catch (err) {
		throw new CpFileError(`fstat \`${path}\` failed: ${err.message}`, err);
	}
};
fork icon0
star icon0
watch icon0