{"id":17398495,"url":"https://github.com/vweevers/jscript","last_synced_at":"2025-10-08T18:11:47.757Z","repository":{"id":57284174,"uuid":"54344836","full_name":"vweevers/jscript","owner":"vweevers","description":"JScript runner as a duplex stream","archived":false,"fork":false,"pushed_at":"2016-12-10T22:03:38.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T21:39:06.454Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/vweevers.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}},"created_at":"2016-03-20T22:53:29.000Z","updated_at":"2024-04-27T14:52:18.000Z","dependencies_parsed_at":"2022-09-16T22:22:10.645Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/jscript","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fjscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fjscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fjscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fjscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/jscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237436,"owners_count":20745348,"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":[],"created_at":"2024-10-16T14:57:33.590Z","updated_at":"2025-10-08T18:11:42.719Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jscript\n\n**[JScript](https://en.wikipedia.org/wiki/JScript) runner: a duplex stream wrapper around [cscript](https://technet.microsoft.com/en-us/library/bb490887.aspx) with optional JSON serialization for easy marshalling of data between Node.js and [Windows Script Host](https://en.wikipedia.org/wiki/Windows_Script_Host).**\n\n[![npm status](http://img.shields.io/npm/v/jscript.svg?style=flat-square)](https://www.npmjs.org/package/jscript) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/jscript.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/jscript) [![Dependency status](https://img.shields.io/david/vweevers/jscript.svg?style=flat-square)](https://david-dm.org/vweevers/jscript)\n\n## example\n\nLet's create a `version.js`: a JScript that reads the `FileVersion` of executables.\n\n```js\nvar JSON = require('json3')\nvar fs = new ActiveXObject('Scripting.FileSystemObject')\n\nwhile(!WScript.StdIn.AtEndOfStream) {\n  var file = JSON.parse(WScript.StdIn.ReadLine())\n\n  if (fs.FileExists(file.path)) {\n    file.version = fs.GetFileVersion(file.path)\n  }\n\n  WScript.StdOut.Write(JSON.stringify(file) + '\\n')\n}\n```\n\nInstall this script's dependencies and create a bundle with [jscriptify](https://www.npmjs.com/package/jscriptify):\n\n```bash\nnpm install json3\nnpm install -g jscriptify\njscriptify version.js \u003e bundle.js\n```\n\nLast but not least, an `example.js`:\n\n```js\nvar jscript = require('jscript')\nvar path = require('path')\nvar duplex = jscript('bundle.js', { json: true })\n\nduplex.on('data', function(file) {\n  console.log(file.version)\n})\n\nprocess.argv.slice(2).forEach(function (file) {\n  duplex.write({ path: path.resolve(file) })\n})\n\nduplex.end()\n```\n\nAnd run it with Node.js:\n\n```bash\n\u003e node example one.exe two.exe\n\n16.4.8\n6.2.3\n```\n\n*Note: avoid `StdOut.WriteLine()` because `json-stream` doesn't like CRLF.*\n\n## `jscript(file, [opts])`\n\n- **file**: relative or absolute path to a JScript file.\n\nOptions:\n\n- **args** (array): script arguments\n- **json** (boolean): if true, wrap stream with JSON serialization\n- **debug** (boolean): if true, pipe stderr to process.stderr;\n- **native**: if false, don't escape WoW64 redirection (passed to [windows-bin](https://www.npmjs.com/package/windows-bin)).\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install jscript\n```\n\n## changelog\n\n### 2.0.0\n\n- Drop support of Node 0.10 and 0.12, add 6 and 7\n- Emit error on non-zero exit code;\n- Remove `wrap` option. Use `{ json: true }` instead.\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fjscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fjscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fjscript/lists"}