parse-spawn-args

1.0.2 • Public • Published

parse-spawn-args

If you need to spawn child process in Node.js, and need to parse a string command to a list arguments that pass to child process, this module will be helpful. Here is examples:

usage

parse args with quote around

var parse = require('parse-spawn-args').parse
parse('-port 80 --title "this is a title"')
/*
    [
        '-port',
        '80',
        '--title',
        'this is a title'
    ]
/*

parse args with quote escape

var parse = require('parse-spawn-args').parse
parse('-port 80 --title "this is a \\"title\\"')
/*
    [
        '-port',
        '80',
        '--title',
        'this is a "title"'
    ]
*/

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.21,283latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.21,283
1.0.15
1.0.05

Package Sidebar

Install

npm i parse-spawn-args

Weekly Downloads

1,293

Version

1.0.2

License

ISC

Last publish

Collaborators

  • shaomq