Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

read-cmd-shim

npm15.6mISC5.0.0

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

readme

read-cmd-shim

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

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.

changelog

Changelog

5.0.0 (2024-09-24)

⚠️ BREAKING CHANGES

  • read-cmd-shim now supports node ^18.17.0 || >=20.5.0

    Bug Fixes

  • 56c8424 #107 align to npm 10 node engine range (@hashtagchris)

    Chores

  • ab0eecd #109 enable auto publish (#109) (@reggi)
  • 442a62a #107 run template-oss-apply (@hashtagchris)
  • b41ae60 #104 bump cmd-shim from 6.0.3 to 7.0.0 (@dependabot[bot])
  • 994fac3 #105 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
  • c4f85f3 #94 linting: no-unused-vars (@lukekarrys)
  • a0a4b33 #94 bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
  • 20721b4 #54 deps: remove rimraf (#54) (@lukekarrys)
  • b41c7e9 #42 bump cmd-shim from 5.0.0 to 6.0.0 (@dependabot[bot])
  • 73b8dd5 #43 bump @npmcli/eslint-config from 3.1.0 to 4.0.0 (@dependabot[bot])
  • 19bd13d #106 postinstall for dependabot template-oss PR (@hashtagchris)
  • 0b8954c #106 bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])

4.0.0 (2022-10-10)

⚠️ BREAKING CHANGES

  • read-cmd-shim is now compatible with the following semver range for node: ^14.17.0 || ^16.13.0 || >=18.0.0

Features

  • 8a9dfed #35 postinstall for dependabot template-oss PR (@lukekarrys)

3.0.1 (2022-08-16)

Bug Fixes

3.0.0 (2022-04-05)

⚠ BREAKING CHANGES

  • this drops support for node 10 and non-LTS versions of node 12 and node 14

Dependencies