in-folder
v1.0.3
Published
Temporarily change directories to run a callback
Downloads
97
Maintainers
Readme
in-folder (a micropackage)
Temporarily change directories to run a callback
Installation
npm install in-folder
Usage
let inside = require('in-folder')
let showFolder = () => console.log("Folder: " + process.pwd())
showFolder()
inside("lib", showFolder)
showFolder()
If the current working directory was '/var', and '/var/lib' existed, then the output would be:
Folder: /var
Folder: /var/lib
Folder: /var
Notes
- Promises, if returned within the callback, will be resolved and returned by in-folder.
- Supports relative and absolute paths
- Uses process.chdir to change folders