time-to-botec/js/node_modules/@stdlib/process/chdir
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00
..
docs feat: add the node modules 2022-12-03 12:44:49 +00:00
lib feat: add the node modules 2022-12-03 12:44:49 +00:00
package.json feat: add the node modules 2022-12-03 12:44:49 +00:00
README.md feat: add the node modules 2022-12-03 12:44:49 +00:00

chdir

Change the current working directory.

Usage

var chdir = require( '@stdlib/process/chdir' );

chdir( path )

Changes the current working directory to the specified path.

var err = chdir( '/foo/bar' );

If the function encounters an error when attempting to change the working directory, the function returns an error; otherwise, the function returns null.

Notes

Examples

var cwd = require( '@stdlib/process/cwd' );
var chdir = require( '@stdlib/process/chdir' );

// Print the current working directory:
var dir = cwd();
console.log( dir );

// Change the current working directory to the directory of this file:
var err = chdir( __dirname );
if ( err ) {
    console.error( err.message );
}

// Print the current working directory:
console.log( cwd() );

// Change the current working directory back to the original directory:
err = chdir( dir );
if ( err ) {
    console.error( err.message );
}

// Print the current working directory:
console.log( cwd() );