This is what I use:
var escapeShell = function(cmd) {
return '"'+cmd.replace(/(["'$`\\])/g,'\\$1')+'"';
};
More Related Contents:
- What is Node.js? [closed]
- ECMAScript 6 features available in Node.js 0.12
- garbage collection with node.js
- node.js shell command execution
- Why is bind slower than a closure?
- Making a javascript string sql friendly
- Why is let slower than var in a for loop in nodejs?
- How to run user-submitted scripts securely in a node.js sandbox?
- Are arrow functions faster (more performant, lighter) than ordinary standalone function declaration in v8?
- Using ‘let’ as a variable name is not throwing any errors in google v8
- Why doesn’t Node.js have a native DOM?
- Increase JavaScript Heap size in create-react-app project
- How does Bluebird’s util.toFastProperties function make an object’s properties “fast”?
- Accessing line number in V8 JavaScript (Chrome & Node.js)
- Maximum number of entries in Node.js Map?
- Node JS / V8 destructuring bug?
- Updating a Nested Array with MongoDB
- Is it not possible to stringify an Error using JSON.stringify?
- Preventing SQL injection in Node.js
- setImmediate vs. nextTick
- Where do the parameters in a javascript callback function come from?
- How to get a URL parameter in Express?
- How to write asynchronous functions for Node.js
- Escape JavaScript in Expression Language
- What does “./bin/www” do in Express 4.x?
- Export HTML table to CSV using vanilla javascript
- Undefined return value from the function call Javascritpt
- Require is not defined after installed nodejs
- Print current stack trace in JavaScript
- Whats the smartest / cleanest way to iterate async over arrays (or objs)?