Skip to content

A node module for traversing a directory recursively and performing a user provided function on each.

License

Notifications You must be signed in to change notification settings

matthewscottconroy/traverse_directory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

traverse_directory

A node module for traversing a directory recursively and performing a user-provided function on each.

##How to use

const traverseDirectory = require('traverse_directory');
let pathToDirectory = "path/to/directory";

function manipulateFile(filename, pathToFile){
  //add code to perform on each file
  //e.g. console.log(pathToFile + "/" + filename);
}

traverseDirectory(pathToDirectory, manipulateFile);

##API

traverseDirectory(directoryPath, performAction)

directoryPath - A string indicating the path to the directory you wish to traverse

performAction(filename, pathToFile) - A user-provided function performed for each file in directoryPath's tree

              * `filename` - the current file being operated on

              * `pathToFile` - the path to the current file

Recursively walks the directory indicated by directoryPath and asynchronously applies the user-provided function, performAction for each file found.

About

A node module for traversing a directory recursively and performing a user provided function on each.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published