Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/npm/read-cmd-shim
Read the path a cmd-shim is pointing at. Acts like fs.readlink but for cmd-shims.
https://github.com/npm/read-cmd-shim
npm-cli
Last synced: about 1 month ago
JSON representation
Read the path a cmd-shim is pointing at. Acts like fs.readlink but for cmd-shims.
- Host: GitHub
- URL: https://github.com/npm/read-cmd-shim
- Owner: npm
- License: isc
- Created: 2015-09-08T23:31:21.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T19:22:34.000Z (about 2 months ago)
- Last Synced: 2024-10-01T16:06:28.993Z (about 1 month ago)
- Topics: npm-cli
- Language: JavaScript
- Homepage:
- Size: 158 KB
- Stars: 10
- Watchers: 22
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# read-cmd-shim
Figure out what a [`cmd-shim`](https://github.com/ForbesLindesay/cmd-shim)
is pointing at. This acts as the equivalent of
[`fs.readlink`](https://nodejs.org/api/fs.html#fs_fs_readlink_path_callback).### Usage
```
const readCmdShim = require('read-cmd-shim')readCmdShim('/path/to/shim.cmd').then(destination => {
…
})const destination = readCmdShim.sync('/path/to/shim.cmd')
```### readCmdShim(path) -> Promise
Reads the `cmd-shim` located at `path` and resolves 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.