Have ideas to improve npm?Join in the discussion! »

    read-cmd-shim

    2.0.0 • Public • Published

    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.

    Keywords

    none

    Install

    npm i read-cmd-shim

    DownloadsWeekly Downloads

    1,444,943

    Version

    2.0.0

    License

    ISC

    Unpacked Size

    4.63 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar