How to use the glob function in glob

To help you get started, we’ve selected a few glob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dmfrancisco / spacehorse / helpers / front-matter.js View on Github external
parseAllFiles(pattern, callback) {
    glob(pattern, (err, filepaths) => {
      if (err) throw err;

      async.map(filepaths, this.parseFile, callback);
    });
  },
  // @param {Object} data - An object with the front matter to stringify
github ustwo / ustwo.com-frontend / src / server / helpers.js View on Github external
getAllComponentNames: function (callback) {
    glob("src/app/components/**/index.js", function (er, files) {
      callback(files.map(function (path) {
        return path.split('/')[3];
      }));
    });
  },
  getAllComponentSandboxNames: function (callback) {
github sogehige / sogeBot / src / bot / widgets / soundboard.ts View on Github external
adminEndpoint(this.nsp, 'getSoundBoardSounds', (cb) => {
      glob('public/dist/soundboard/*.mp3', (err, files) => {
        if (err) {
          return cb([]);
        }

        const sounds: string[] = [];
        for (const file of files) {
          const filename = file.split('/').pop();
          if (filename) {
            sounds.push(filename.replace('.mp3', ''));
          }
        }
        cb(sounds);
      });
    });
  }
github flatlogic / react-dashboard / tools / lib / fs.js View on Github external
new Promise((resolve, reject) =>
    glob(
      pattern,
      options,
      (err, result) => (err ? reject(err) : resolve(result)),
    ),
  );
github neo-one-suite / neo-one / packages / neo-one-editor / src / loaders / packagesLoader.ts View on Github external
const filesPromise = new Promise((resolve, reject) =>
    glob(path.join(packageDir, '**', '*'), (err, found) => {
      if (err) {
        reject(err);
      } else {
        resolve(found);
      }
    }),
  );
github adrianObel / koa2-api-boilerplate / src / modules / index.js View on Github external
exports = module.exports = function initModules (app) {
  glob(`${__dirname}/*`, { ignore: '**/index.js' }, (err, matches) => {
    if (err) { throw err }

    matches.forEach((mod) => {
      const router = require(`${mod}/router`)

      const routes = router.default
      const baseUrl = router.baseUrl
      const instance = new Router({ prefix: baseUrl })

      routes.forEach((config) => {
        const {
          method = '',
          route = '',
          handlers = []
        } = config
github flatpickr / flatpickr / build.ts View on Github external
return new Promise((resolve, reject) => {
    glob(g, (err: Error | null, files: string[]) =>
      err ? reject(err) : resolve(files)
    );
  });
}
github elementary / houston / src / flightcheck / file / index.js View on Github external
const globPaths = await new Promise((resolve, reject) => {
      glob(this._glob, (err, files) => {
        if (err) return reject(err)
        return resolve(files)
      })
    })
github happo / happo.io / src / findTestFiles.js View on Github external
return new Promise((resolve, reject) => {
    glob(
      pattern,
      {
        ignore: ['**/node_modules/**', '**/dist/**', '**/build/**'],
      },
      (err, files) => {
        if (err) {
          reject(err);
          return;
        }
        resolve(files);
      },
    );
  });
}