How to use the subdirs function from node-dir

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

381
382
383
384
385
386
387
388
389
390
391
    })
  })


const subdirs = (rootdir) =>
  new Promise((resolve, reject) => {
    dir.subdirs(rootdir, (err, subdirs) => {
      if (err) reject(err)
      resolve(subdirs)
    })
  })
fork icon4
star icon13
watch icon0

+ 4 other calls in file

18
19
20
21
22
23
24
25
26
27
28
  'declare-styleable'
]


function generatePublicXml (rootDir) {
  return new Promise((resolve, reject) => {
    dir.subdirs(rootDir, function (err, subdirs) {
      if (err) {
        reject(err)
        return
      }
fork icon2
star icon6
watch icon0

98
99
100
101
102
103
104
105
106
107
    this.listSubDirs(sourceDir, (ignore, dirs) => resolve(dirs));
  });
},
// List all subdir paths
listSubDirPaths : function(sourceDir, callback) {
  dir.subdirs(sourceDir, callback);
},
/**
The write file method will first create the folder for the file to be in
*/
fork icon2
star icon3
watch icon0

70
71
72
73
74
75
76
77
78
79
let counter = 0;

srcList.forEach( mediaPath => {
        pathKeys.push( resolve( mediaPath ));
        counter++;
        dir.subdirs(mediaPath, (err, subdirs) => {
                counter--;
                if (err) {
                        console.log('UpdateOnlineList error', err);
                        return;
fork icon0
star icon2
watch icon1

61
62
63
64
65
66
67
68
69
70
case "xtheme":
    // Rebuild based on contents
    xtheme.destroy().exec(function (err, dels) {
        // Get all the files in the themes folder(s)
        var xpath = path.join(sails.config.appPath, "assets", "css");
        dir.subdirs(xpath, function (err, dirs) {
            var themes = [];
            _.forEach(dirs, function (sd, d) {
                if (path.basename(path.dirname(sd)) == "css") {
                    // Must have a file in it called "jquery-ui-<version>.custom.css"
fork icon2
star icon0
watch icon0

120
121
122
123
124
125
126
127
128
129
      re2 = new RegExp(/S(\d{1,2})E(\d{1,2})/); // S(season_number)E(episode_number)
      json = { tv: [] };

console.log('Generating data for TV...')
let subdirs = await new Promise((resolveSubdirs) => {
  node_dir.subdirs(config.tv.path, async (err, subdirs) => {
    if (err) throw err;
    resolveSubdirs(subdirs);
  });
});
fork icon0
star icon0
watch icon0

160
161
162
163
164
165
166
167
168
169
//options do beautify
var beautifyOptions = {
  indentSize: 2
};

var subdirsList = dir.subdirs(partialsDir, function(err, subdirs) {
  if (err) {
    throw err;
  } else {
    //console.log(subdirs);
fork icon0
star icon0
watch icon0