Security News
The Dark Side of Open Source
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.
shebang-command
Advanced tools
Package description
The shebang-command npm package is used to parse the shebang (#!) line of a file to determine which interpreter should be used to execute the file. This is particularly useful when working with scripts in a Node.js environment where you might need to identify the interpreter specified in a script file.
Parse shebang line
This feature allows you to extract the command from the shebang line of a script. The code sample represents a script file with a shebang line that specifies that the script should be run with Node.js.
"#!/usr/bin/env node\nconsole.log('Hello, world!');"
The shebang-regex package provides a regular expression for matching shebang lines. It is similar to shebang-command in that it helps with shebang lines, but it does not parse the line to extract the command; it only provides the regex for matching.
The hashbang package is another tool that can be used to manage shebang lines in scripts. It is similar to shebang-command but offers a different API and might have different use cases or preferences for developers.
Readme
Get the command from a shebang
$ npm install shebang-command
const shebangCommand = require('shebang-command');
shebangCommand('#!/usr/bin/env node');
//=> 'node'
shebangCommand('#!/bin/bash');
//=> 'bash'
Type: string
String containing a shebang.
FAQs
Get the command from a shebang
The npm package shebang-command receives a total of 59,435,884 weekly downloads. As such, shebang-command popularity was classified as popular.
We found that shebang-command demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
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.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.