1. read-cmd-shim
Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.
read-cmd-shim
Package: read-cmd-shim
Created by: npm
Last modified: Wed, 09 Aug 2023 16:59:31 GMT
Version: 4.0.0
License: ISC
Downloads: 13,748,647
Repository: https://github.com/npm/read-cmd-shim

Install

npm install read-cmd-shim
yarn add read-cmd-shim

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.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code