Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
cmd-shim
Advanced tools
Package description
The cmd-shim npm package is designed to create command shims (or symbolic links) on Windows and Unix-like systems for node.js scripts. This allows node.js scripts to be executed as if they were native commands in the user's shell, making it easier to use node.js tools across different platforms without worrying about the underlying differences in how executable scripts are handled.
Creating command shims
This feature allows the creation of a command shim for a node.js script. The code sample demonstrates how to create a shim for a node.js script located at 'path/to/node-script.js' and place the resulting shim at 'path/to/shim'. This makes the script executable as if it were a native command.
const cmdShim = require('cmd-shim');
cmdShim('path/to/node-script.js', 'path/to/shim', function (err) {
if (err) throw err;
});
npx is a package runner tool that comes with npm. It allows you to execute any package from the npm registry without having to install it globally. While npx does not create shims, it provides a similar convenience by allowing direct execution of node.js scripts and commands. Unlike cmd-shim, npx is focused on temporary or one-off execution rather than creating a persistent executable shim.
ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. While it primarily offers a way to script shell commands within Node.js, it shares the cross-platform scripting goal with cmd-shim. However, ShellJS does not specifically focus on creating command shims but rather on providing a wide range of shell commands within Node.js scripts.
Changelog
Readme
The cmd-shim used in npm to create executable scripts on Windows, since symlinks are not suitable for this purpose there.
On Unix systems, you should use a symbolic link instead.
npm install cmd-shim
Create a cmd shim at to
for the command line program at from
.
e.g.
var cmdShim = require('cmd-shim');
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name').then(() => {
// shims are created!
})
The same as above, but will just continue if the file does not exist.
FAQs
Used in npm for command line application support
The npm package cmd-shim receives a total of 2,593,834 weekly downloads. As such, cmd-shim popularity was classified as popular.
We found that cmd-shim demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.