How to use the statSync function from graceful-fs
Find comprehensive JavaScript graceful-fs.statSync code examples handpicked from public code repositorys.
GitHub: rstudio/shiny-server
18 19 20 21 22 23 24 25 26 27
/** * Returns true if the path exists and is a directory, false otherwise. */ function directoryExistsSync(path) { try { var stats = fs.statSync(path); return stats.isDirectory(); } catch (e) { if (e.code === 'ENOENT') return false;
291
672
0
GitHub: canarddu38/DUCKSPLOIT
519 520 521 522 523 524 525 526 527 528 529
exports.rmdir = rmdir; exports.rmdirSync = rmdirSync; // 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;
9
48
0
+ 7 other calls in file
GitHub: csyslabs/csyslabs.github.io
206 207 208 209 210 211 212 213 214 215
return fs.readdirSync(path) .filter(ignoreHiddenFiles(options.ignoreHidden == null ? true : options.ignoreHidden)) .filter(ignoreFilesRegex(options.ignorePattern)) .map(item => { const fullPath = join(path, item); const stats = fs.statSync(fullPath); return { isDirectory: stats.isDirectory(), path: item,
0
1
0
+ 23 other calls in file
GitHub: lesly-mlab/mlab-app-v2
12 13 14 15 16 17 18 19 20 21 22
const d = new Date(1435410243862) fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') const fd = fs.openSync(tmpfile, 'r+') fs.futimesSync(fd, d, d) fs.closeSync(fd) return fs.statSync(tmpfile).mtime > 1435410243000 } function hasMillisRes (callback) { let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2))
1
0
0
47 48 49 50 51 52 53 54 55 56 57 58
} } } function moveSyncAcrossDevice (src, dest, overwrite) { const stat = fs.statSync(src) if (stat.isDirectory()) { return moveDirSyncAcrossDevice(src, dest, overwrite) } else {
0
1
0
9 10 11 12 13 14 15 16 17 18 19
const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const casesPath = path.join(__dirname, "hotCases"); let categories = fs .readdirSync(casesPath) .filter(dir => fs.statSync(path.join(casesPath, dir)).isDirectory()); categories = categories.map(cat => { return { name: cat, tests: fs
163
0
24
+ 13 other calls in file
16 17 18 19 20 21 22 23 24 25
if (!fs.existsSync(dest)) fs.mkdirSync(dest); const files = fs.readdirSync(src); files.forEach(filename => { const srcFile = path.join(src, filename); const destFile = path.join(dest, filename); const directory = fs.statSync(srcFile).isDirectory(); if (directory) { copyDiff(srcFile, destFile, initial); } else { var content = fs.readFileSync(srcFile);
163
0
24
+ 13 other calls in file
93 94 95 96 97 98 99 100 101 102
const testDirectory = path.join(casesPath, category.name, testName); const runs = fs .readdirSync(testDirectory) .sort() .filter(name => { return fs.statSync(path.join(testDirectory, name)).isDirectory(); }) .map(name => ({ name })); beforeAll(done => {
0
0
1
+ 15 other calls in file
255 256 257 258 259 260 261 262 263 264
if (!active) { return Promise.resolve(); } try { fs.statSync(cacheAssetDirPath); } catch (_) { mkdirp.sync(cacheAssetDirPath); logMessages.configHashFirstBuild(compiler, { cacheDirPath,
0
0
1
+ 30 other calls in file
188 189 190 191 192 193 194 195 196 197
if (!options.mode || !options.chown) { // Either mode or chown is not explicitly set // Default behavior is to copy it from original file try { var stats = fs.statSync(filename) options = Object.assign({}, options) if (!options.mode) { options.mode = stats.mode }
0
0
0
+ 3 other calls in file
GitHub: Sathish9686/Gadgets-Page
74 75 76 77 78 79 80 81 82 83 84
} }; exports.statSync = path => { try { return fs.statSync(path); } catch (error) { throw new CpFileError(`stat \`${path}\` failed: ${error.message}`, error); } };
0
0
0
graceful-fs.promises is the most popular function in graceful-fs (1135 examples)