Socket
Socket
Sign inDemoInstall

shellwords

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shellwords

Manipulate strings according to the word parsing rules of the UNIX Bourne shell.


Version published
Maintainers
1
Created

What is shellwords?

The shellwords package is designed to manipulate strings according to the word parsing rules of the UNIX Bourne shell. It provides functionality for splitting a string into an array of tokens in the same way the shell would and for escaping and joining words into a single string that can be safely used in a shell command.

What are shellwords's main functionalities?

Splitting a string into an array of tokens

This feature allows you to split a command line string into an array of tokens, similar to how a UNIX shell would. It's useful for parsing command line arguments or processing shell commands within a Node.js application.

"const shellwords = require('shellwords');
const cmd = 'ls -la /some/path with spaces';
const tokens = shellwords.split(cmd);
console.log(tokens);"

Escaping and joining words into a shell command

This feature enables you to take an array of command line arguments and join them into a single string that is safe to use in a shell command. It automatically escapes any characters that have special meaning in the shell, making it easier to construct shell commands programmatically.

"const shellwords = require('shellwords');
const args = ['ls', '-la', '/some/path with spaces'];
const cmd = shellwords.join(args);
console.log(cmd);"

Other packages similar to shellwords

FAQs

Package last updated on 17 Aug 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc