Lines 20-60javascript
20 --strip-types Strip TypeScript type annotations
21 --version, -V Show version
25 js-exec -c "console.log(1 + 2)"
28 echo 'console.log("hello")' | js-exec
30File Extension Auto-Detection:
31 .js script mode (module mode if top-level await detected)
33 .ts, .mts ES module mode + TypeScript stripping
36 Code written for Node.js largely works here. Both require and import
37 are supported, the node: prefix works, and standard globals like process,
38 console, and fetch are available. All I/O is synchronous.
41 fs, path, child_process, process, console,
42 os, url, assert, util, events, buffer, stream,
HighChild Process
Package source references child process execution.
dist/js-exec-N5KEZBH7-CqxMtdCQ.cjsView on unpkg · L40 43 string_decoder, querystring
45 fs (global, require('fs'), or import from 'node:fs'):
46 readFileSync, writeFileSync, appendFileSync, copyFileSync, renameSync
47 readdirSync, mkdirSync, rmSync, unlinkSync, rmdirSync
48 statSync, lstatSync, existsSync, realpathSync, chmodSync
49 symlinkSync, readlinkSync, readFileBuffer
50 fs.promises.readFile, fs.promises.writeFile, fs.promises.access, ...
52 path: join, resolve, dirname, basename, extname, normalize,
53 relative, isAbsolute, parse, format, sep, delimiter
56 execSync(cmd) throws on non-zero exit, returns stdout
57 spawnSync(cmd, args) returns { stdout, stderr, status }
HighCross File Remote Execution Context
Source spawns a local helper that also contains network and dynamic execution context; review data flow before blocking.
dist/js-exec-N5KEZBH7-CqxMtdCQ.cjsView on unpkg · L40 59 process (also global): argv, cwd(), exit(), env, platform, arch,