Skip to content

finwo/node-scandir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

scandir

Simple scandir for my own purposes, as I've used versions of this throughout multiple projects.

Usage

const scandir = require('@finwo/scandir');

// No way to await in async yet
scandir("path/to/directory", filename => {
  console.log(`Got a filename: ${filename}`);
}, ['json', 'js']);

// You can also load files directly (caution, may be dangerous)
// This loads the file through 'require'
scandir("path/to/directory", contents => {
  console.log(`Got file contents: ${contents}`);
}, ['json','js'], true);

// There's also a sync version, if that's what you need
// This accepts the same arguments
scandir.sync("path/to/directory", filename => {
  console.log(`Got a filename: ${filename}`);
}, ['json', 'js'], false);

Methods

scandir( dir, handler, extensions = ['json','js'], load = false)

scandir.sync( dir, handler, extensions = ['json','js'], load = false)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published