How to use the readFiles function from node-dir

Find comprehensive JavaScript node-dir.readFiles code examples handpicked from public code repositorys.

91
92
93
94
95
96
97
98
99
100
}

const generator = (createNode) => (
  Promise.all([
    new Promise((resolve, reject) => {
      dir.readFiles(
        blogConfig.siteBlogPath,
        fileReadingOptions,
        sourceBlogs(createNode),
        resolve
fork icon128
star icon0
watch icon4

+ 3 other calls in file

107
108
109
110
111
112
113
114
115
116

/**
 * Post processing for example files
 */
function postProcessingOfExampleFiles() {
  nodedir.readFiles(
    COPY_FILES_PATH,
    {
      match: /.html$/,
      recursive: true
fork icon15
star icon100
watch icon13

23
24
25
26
27
28
29
30
31
32

var mdFiles = {},
    aliases = {},
    dirOpts = { match: /.md/, exclude: /^_/ }

dir.readFiles(wikiPath, dirOpts, function (err, content, filename, next) {
    if (!err) {
      mdFiles[filename] = content
      var base = path.basename(filename)
      aliases[base.substr(0, base.length - 3)] = filename
fork icon62
star icon40
watch icon3

5
6
7
8
9
10
11
12
13
14

const files = []

printOptions(options)

readFiles(
  options.source,
  {
    match: new RegExp(`\\.(?:${options.extensions.join('|')})$`),
    exclude: options.exclude && new RegExp(options.exclude),
fork icon3
star icon8
watch icon1

74
75
76
77
78
79
80
81
82
83
}

function buildMarkdown(callback) {
  var terms = {};

  dir.readFiles('./metaphors', {
    match: /.md$/,
    exclude: /^\./,
    recursive: false
  }, function(err, content, filename, next) {
fork icon6
star icon5
watch icon1

73
74
75
76
77
78
79
80
81
82
83


/**
 * Process values folder containing resource xml files
 */
function processValuesFolder (path, callback) {
  dir.readFiles(path,
    {
      match: /\.xml$/
    },
    function (err, content, filename, next) {
fork icon2
star icon6
watch icon0

227
228
229
230
231
232
233
234
235
236
Expect(fileMatch).is.a.String('fSRD filematch');
Expect(options).is.an.Object();
return new Promise((resolve, reject) => {
    let filteredList = [];
    let rejectList = [];
    Dir.readFiles(dir , {
        match:     new RegExp(fileMatch),
        exclude:   /^\./,
        recursive: false
    }, function(err, content, filepath, next) {
fork icon0
star icon0
watch icon2

+ 11 other calls in file