node/deps/npm/node_modules/read-cmd-shim
Kat Marchán c0d858f8bb
deps: upgrade npm beta to 5.0.0-beta.56
PR-URL: https://github.com/nodejs/node/pull/12936
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-05-23 19:39:43 +02:00
..
test deps: upgrade npm to 3.3.6 2015-10-22 13:56:09 -04:00
.npmignore deps: upgrade npm to 3.3.6 2015-10-22 13:56:09 -04:00
index.js deps: upgrade npm to 3.3.6 2015-10-22 13:56:09 -04:00
package.json deps: upgrade npm beta to 5.0.0-beta.56 2017-05-23 19:39:43 +02:00
README.md deps: upgrade npm to 3.3.6 2015-10-22 13:56:09 -04:00

read-cmd-shim

Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.

Usage

var readCmdShim = require('read-cmd-shim')

readCmdShim('/path/to/shim.cmd', function (er, destination) {
  …
})

var destination = readCmdShim.sync('/path/to/shim.cmd')

### readCmdShim(path, callback)

Reads the `cmd-shim` located at `path` and calls back with the _relative_
path that the shim points at. Consider this as roughly the equivalent of
`fs.readlink`.

This can read both `.cmd` style that are run by the Windows Command Prompt
and Powershell, and the kind without any extension that are used by Cygwin.

This can return errors that `fs.readFile` returns, except that they'll
include a stack trace from where `readCmdShim` was called.  Plus it can
return a special `ENOTASHIM` exception, when it can't find a cmd-shim in the
file referenced by `path`.  This should only happen if you pass in a
non-command shim.


### readCmdShim.sync(path)

Same as above but synchronous. Errors are thrown.