1.0.3 • Published 7 years ago

in-folder v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

in-folder (a micropackage)

Temporarily change directories to run a callback

NPM Version Linux Build Windows Build Test Coverage

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

License

MIT