npm/read-cmd-shim

Name: read-cmd-shim

Owner: npm

Description: Read the path a cmd-shim is pointing at. Acts like fs.readlink but for cmd-shims.

Created: 2015-09-08 23:31:21.0

Updated: 2018-01-25 17:51:25.0

Pushed: 2017-10-14 10:34:05.0

Homepage: null

Size: 5

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

read-cmd-shim

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

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

CmdShim('/path/to/shim.cmd', function (er, destination) {



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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.