util.chdir
TypeScript icon, indicating that this package has built-in type declarations

0.0.43 • Public • Published

util.chdir

An implementation of pushd/popd for JavaScript

build analysis code style: prettier testing NPM

This mimics the bash pushd/popd functions. When changing a directory the pushd will place the current directory onto a stack and then change to the requested directory. When popd is called, then the previous directory is restored from the top of that stack. This is a way to simplify backtracking through a directory hierarchy.

Installation

This module uses yarn to manage dependencies and run scripts for development.

To install as a global package and cli:

$ yarn global add util.chdir

To install as a development dependency with cli:

$ yarn add --dev util.chdir

To build the app and run all tests:

$ yarn run all

Usage

const chdir = require('util.chdir');

// assume directory is /home
chdir.pushd('/tmp');
// pushes /home on the stack and changes to /tmp

chdir.popd();
// pops the top of the stack and switches to that directory

Readme

Keywords

none

Package Sidebar

Install

npm i util.chdir

Weekly Downloads

10

Version

0.0.43

License

MIT

Unpacked Size

6.46 kB

Total Files

6

Last publish

Collaborators

  • jmquigley