Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.
npm install read-cmd-shimFigure out what a cmd-shim
is pointing at. This acts as the equivalent offs.readlink.
``
const readCmdShim = require('read-cmd-shim')
readCmdShim('/path/to/shim.cmd').then(destination => {
…
})
const destination = readCmdShim.sync('/path/to/shim.cmd')
`
Reads the cmd-shim located at path and resolves with the _relative_fs.readlink
path that the shim points at. Consider this as roughly the equivalent of.
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'llreadCmdShim
include a stack trace from where was called. Plus it canENOTASHIM
return a special exception, when it can't find a cmd-shim in thepath`. This should only happen if you pass in a
file referenced by
non-command shim.
Same as above but synchronous. Errors are thrown.