How to use the readdir function from fs-promise

Find comprehensive JavaScript fs-promise.readdir code examples handpicked from public code repositorys.

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()
fork icon3
star icon39
watch icon0

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);
fork icon0
star icon1
watch icon11

+ 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));
        });
fork icon0
star icon0
watch icon0

+ 3 other calls in file