How to use the opendir function from fs
Find comprehensive JavaScript fs.opendir code examples handpicked from public code repositorys.
115 116 117 118 119 120 121 122 123 124
await fsPromises.opendir(folder); } catch (e) { await fsPromises.mkdir(folder, {recursive: false}); } /* await fs.opendir(folder, async (err, dir) => { if (err) { // await fs.mkdir(folder, {recursive: false}, (err) => { // // Any callback that needs to happen on first folder create // // can happen here.
0
6
0
187 188 189 190 191 192 193 194 195 196 197 198
fs.readdir('./', () => {}); } function opendir() { const fs = require('fs'); fs.opendir('./', () => {}); } function realpath() { const fs = require('fs');
0
0
0
+ 2 other calls in file
90 91 92 93 94 95 96 97 98 99 100 101
assert.throws(function() { fs.opendirSync(__filename); }, /Error: ENOTDIR: not a directory/); assert.throws(function() { fs.opendir(__filename); }, /TypeError \[ERR_INVALID_CALLBACK\]: Callback must be a function/); fs.opendir(__filename, common.mustCall(function(e) { assert.strictEqual(e.code, 'ENOTDIR');
0
0
1
+ 3 other calls in file
191 192 193 194 195 196 197 198 199 200 201
code: 'ERR_ACCESS_DENIED', permission: 'FileSystemRead', }); } // fs.opendir { assert.throws(() => { fs.opendir(blockedFolder, (err) => { assert.ifError(err);
0
0
0
+ 5 other calls in file
fs.readFileSync is the most popular function in fs (2736 examples)