tape("styleFiles", (test) => { test.plan(4); fs.readdir("./style", function readdir(err, files) { test.ifError(err); files.forEach(function forFile(file) { test.ok(require(path.join("../style", file)), "Unable to load/parse."); }); test.end(); }); });
fs.readdir("./icons", function (err, files) { extract(files); if (!fs.existsSync("./dist")) { fs.mkdirSync("./dist"); } fs.writeFile('./dist/icons.json', JSON.stringify(svgObject), (err) => { if (err) throw err; console.log(chalk.whiteBright.bgBlack.bold("Created [JSON] for SVG Icons !! ")); }); });
this._asyncFSwrapper.readdir(tcwd).catch(err => { console.warn(err); if (this._noTracking === true && this.dirpath) { // #262 this.setFailedState(); setTimeout(() => { this.readFS(this.dirpath); }, 1000); } else { this.setFailedState(); } })
// This function has two meanings: // 1. Build for the specific language. // 2. Choose what languages for the menu. function dynamicallyBuildOnLanguages (source, locale) { if (!selectedLocales || selectedLocales.length === 0) { fs.readdir(path.join(__dirname, 'locale'), (err, locales) => { if (err) { throw err } const filteredLocales = locales.filter(file => junk.not(file)) const localesData = build.generateLocalesData(filteredLocales) build.buildLocale(source, locale, { preserveLocale, localesData }) }) } else { const localesData = build.generateLocalesData(selectedLocales) build.buildLocale(source, locale, { preserveLocale, localesData }) } }
fs.readdir(basePath, function (err, fileNames) { if (err) throw err;
return; const directory = directories.shift(); await new Promise(done => fs.readdir(directory, 'utf8', async(err, files) => { if (err) { done();
fs.readdir(directory.path, (err, files) => {
// This is where the build is orchestrated from, as indicated by the function // name. It brings together all build steps and dependencies and executes them. function fullBuild (opts) { const { selectedLocales, preserveLocale } = opts getSource((err, source) => { if (err) { throw err } // Executes the build cycle for every locale. fs.readdir(path.join(__dirname, 'locale'), (e, locales) => { if (e) { throw e } const filteredLocales = locales.filter(file => junk.not(file) && (selectedLocales ? selectedLocales.includes(file) : true)) const localesData = generateLocalesData(filteredLocales) filteredLocales.forEach((locale) => { buildLocale(source, locale, { preserveLocale, localesData }) }) }) }) }
fs.readdir(directory.path, (err, files) => {
describe('.close()', () => { it('should have cleaned up all', async () => { const readdir = require('util').promisify(require('fs').readdir); const channelName = AsyncTestUtil.randomString(12); const channelState = await NodeMethod.create(channelName); await NodeMethod.close(channelState); await AsyncTestUtil.wait(200); const paths = NodeMethod.getPaths(channelName); const files = await readdir(paths.readers); assert.equal(files.length, 0); }); });
//图片重命名 fs.readdir(path.join(modulePath, 'widget', widgetName, 'images'), function(err, files) { files.forEach(function(filename) { var oldPath = path.join(modulePath, 'widget', widgetName, 'images', filename), newPath = path.join(modulePath, 'widget', widgetName, 'images', filename.replace(pattern, widgetName)) fs.rename(oldPath, newPath, function(err) { if (err) { console.log(chalk.red(' 修改图片名 ' + filename + ' 失败,请联系组件作者查看图片名是否符合规范。')); } }) }); });
/** * returns the uuids of all readers * @return {string[]} */ async function getReadersUuids(channelName, paths) { paths = paths || getPaths(channelName); const readersPath = paths.readers; const files = await readdir(readersPath); return files .map(file => file.split('.')) .filter(split => split[1] === 'json') // do not scan .socket-files .map(split => split[0]); }
/** * returns the amount of channel-folders in the tmp-directory * @return {Promise<number>} */ async function countChannelFolders() { await ensureBaseFolderExists(); const folders = await readdir(TMP_FOLDER_BASE); return folders.length; }
function walk(state, dir, currentDepth, callback) { if (currentDepth < 0) { --state.queue; return; } readdir(dir, readdirOpts, function(error, dirents) { if (error) { --state.queue; callback(error, state); return; } walkSingleDir(walk, state, dir, dirents, currentDepth, callback); if (--state.queue < 0) callback(null, state); }); }
this._asyncFSwrapper.readdir(tcwd).catch(err => { console.warn(err); if (this._noTracking === true && this.dirpath) { // #262 this.setFailedState(); setTimeout(() => { this.readFS(this.dirpath); }, 1000); } else { this.setFailedState(); } })