How to use the readdir function from fs-promise
Find comprehensive JavaScript fs-promise.readdir code examples handpicked from public code repositorys.
GitHub: marijnh/distfs
32 33 34 35 36 37 38 39 40 41 42
return this.read() } CachedDir.prototype.read = function() { var self = this return this.updating = fs.readdir(this.path).then(function(files) { self.updating = null self.upToDate = true for (var file in self.cache) if (files.indexOf(file) == -1) { self.cache[file].detach()
3
39
0
108 109 110 111 112 113 114 115 116 117
libraryTarget = (env && env.libraryTarget) || 'var'; outputPath = (env && env.outputPath) || path.resolve(__dirname, 'build', 'parsers'); global.enable_debug = Boolean(env && parseInt(env.enable_debug)); // Then, find language configuration files const files = await fs.readdir(config.lang_configs_path); // Filter langs and compile them. // Prepare_lang returns a promise, so after this step we have an array of promises. const lang_configs = files.filter(filter_lang).map(prepare_lang);
0
1
11
+ 4 other calls in file
81 82 83 84 85 86 87 88 89 90
/** * @param {string} playlist * @returns {Promise<Object>} Resolves with array of videos {id, name, playlistName} */ function getVideos(playlist) { return fs.readdir(path.join(baseDir, playlist)) .then(elements => filterFiles(playlist, elements)) .then(fileNames => { return fileNames.map(fileName => buildVideo(playlist, fileName)); });
0
0
0
+ 3 other calls in file
fs-promise.writeJson is the most popular function in fs-promise (6458 examples)