{"id":19217495,"url":"https://github.com/lwdgit/node-fire","last_synced_at":"2025-10-27T08:04:53.868Z","repository":{"id":79040388,"uuid":"83817330","full_name":"lwdgit/node-fire","owner":"lwdgit","description":"Run a js object, Promise, Generator or a (async)function by CLI directly.","archived":false,"fork":false,"pushed_at":"2017-04-21T14:37:39.000Z","size":79,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-05-05T23:37:36.690Z","etag":null,"topics":["cli","commandline-interface","fire","flow"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lwdgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-03T16:15:50.000Z","updated_at":"2020-08-08T22:12:25.000Z","dependencies_parsed_at":"2023-03-12T06:29:26.729Z","dependency_job_id":null,"html_url":"https://github.com/lwdgit/node-fire","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":0.2857142857142857,"last_synced_commit":"8448b1ee2cf33622ec5ed87c39be9d5a20ce81a4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fnode-fire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fnode-fire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fnode-fire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fnode-fire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwdgit","download_url":"https://codeload.github.com/lwdgit/node-fire/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843216,"owners_count":21972874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","commandline-interface","fire","flow"],"created_at":"2024-11-09T14:22:31.005Z","updated_at":"2025-10-27T08:04:53.795Z","avatar_url":"https://github.com/lwdgit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-fire\n\n\u003e Run a js object, Promise, Generator or a (async) function by command line directly.\n\n## Install\n\n```\n$ npm install -g node-fire\n```\n\n## How to use\n\n```\n$ fire ./test.js arg1 arg2 name=john\n```\n\n### Fire third party node modules\n\n```bash\n\u003e npm install md5\n\u003e fire md5 test\n\u003e npm install uuid\n\u003e fire uuid\n\u003e npm install open\n\u003e fire open http://127.0.0.1\n...\n```\n\n[More Example](./examples.md)\n\n### Fire remote js\n\u003e curl https://raw.githubusercontent.com/lwdgit/node-fire/dev/examples/calc.js | fire add 1 2\n\n### Fire local\n\n#### Test1 \n    ```\n    //test.js\n    module.exports = function(arg1, arg2) {\n        console.log(arg1, Array.isArray(arg1));\n        console.log(arg2);\n        console.log(this.arg3);\n        console.log(this.arg4);\n        return 'done';\n    }\n    ```\n    RUN\n    ```\n    fire ./test.js \"1,2,3,4\" hello --arg3 world --arg4 \"the end\"\n    ```\n    Output:\n\n    ```\n    [ '1', '2', '3', '4' ] true\n    hello\n    world\n    the end\n    done\n    ```\n\n#### Test2\n\n```javascript\n//test2.js\nmodule.exports = function (a, opts, c) {\n  return `${a} ${opts.name}${c}`\n}\n```\nRUN\n```\nfire ./test2.js hello name=world !\n```\nOutput:\n\n```\nhello world!\n```\n\n#### One more\n\n```\n//calc.js\nexports.add = function(a, b) {\n    return a + b;\n}\n\nexports.multiply = function*(a, b) {\n    return a * b;\n}\n\nexports.pow = function(a) {\n    return a * a;\n}\nexports.div = function(a, b) {\n    b = b || this.b;\n    return a / b;\n}\n```\nRUN\n```\nfire ./calc.js add 3 4                // 7\nfire ./calc.js multiply 3 4           // 12\nfire ./calc.js pow 3                  //9\nfire examples/calc.js div 8 0 --b=2   //4         \n```\n\n### As a wrapper\n```\n//wrap.js\nconst { wrap } = require('node-fire');\nconst calc = function(a, b) {\n    return a + b;\n}\n\nwrap(calc)(process.argv)\n.then(function (ret) {\n    console.log(ret);\n});\n```\n\n```\nnode ./wrap.js 3 4\n```\n\n### As a npm scripts runner\n\n```\n//package.json\n{\n  \"scripts\": {\n    \"open\": \"fire open http://127.0.0.1\",\n    \"copy\": \"fire shelljs cp package.json package.json2\",\n    \"combo\": \"fire mathjs random 0 100 | xargs touch \",\n    \"math\": \"fire mathjs add 42423.321 32132\"\n  },\n  \"devDependencies\": {\n    \"mathjs\": \"^3.9.3\",\n    \"open\": \"^0.0.5\",\n    \"shelljs\": \"^0.7.6\",\n    \"node-fire\": \"latest\"\n  }\n}\n```\nquick test:\n\n```\nmkdir quick_test \u0026\u0026 cd quick_test\ncat \u003c\u003c EOF \u003e package.json\n{\n  \"scripts\": {\n    \"open\": \"fire open http://127.0.0.1\",\n    \"copy\": \"fire shelljs cp ...package.json,package.json2\",\n    \"combo\": \"fire mathjs random 0 100 | xargs touch \",\n    \"math\": \"fire mathjs add 42423.321 32132\",\n    \"ls\": \"fire shelljs ls stdout\"\n  },\n  \"devDependencies\": {\n    \"mathjs\": \"^3.9.3\",\n    \"open\": \"^0.0.5\",\n    \"shelljs\": \"^0.7.6\",\n    \"node-fire\": \"latest\"\n  }\n}\nEOF\n\nnpm install\nnpm run math\nnpm run copy\nnpm run combo\nnpm run open\n\n```\n\n\u003e More usage please checkout [tests](https://github.com/lwdgit/node-fire/tree/dev/test)\n\n## Debug\n\n\u003e DEBUG=log fire xxx.js\n\n## Contribution\n\n [Fork](https://github.com/lwdgit/node-fire#fork-destination-box)\n\n [Issues](https://github.com/lwdgit/node-fire/issues)\n\n## LICENSE\nUnder MIT license\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwdgit%2Fnode-fire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwdgit%2Fnode-fire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwdgit%2Fnode-fire/lists"}