How to use the walkdir.async function in walkdir

To help you get started, we’ve selected a few walkdir 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 TencentCloudBase / cloudbase-manager-node / src / storage / index.ts View on Github external
private async walkLocalDir(dir: string, ignore?: string | string[]) {
        try {
            return walkdir.async(dir, {
                filter: (dir: string, files: string[]) => {
                    // NOTE: ignore 为空数组时会忽略全部文件
                    if (!ignore || !ignore.length) return files
                    return micromatch.not(files, ignore)
                }
            })
        } catch (e) {
            throw new CloudBaseError(e.message)
        }
    }
}
github google / nodejs-container-image-builder / src / walker.ts View on Github external
});
      }

      // walkdir supports mixing sync and async returns
      if (!unread.length) {
        return applyRules(dir, files);
      }

      return Promise.all(unread).then(() => {
        // new ignore files have been read.
        return applyRules(dir, files);
      });
    };
  }
  options.find_links = false;
  return walkdir.async(entryDir, options, onStat);
};

walkdir

Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familiar callback/emitter/a+sync interface. Walk a tree of any depth.

MIT
Latest version published 5 years ago

Package Health Score

73 / 100
Full package analysis