Registry / devops / bytenode

bytenode

JSON →
library1.5.7jsnpmunverified

Bytenode is a minimalist bytecode compiler for Node.js that compiles JavaScript code into V8 bytecode, stored as .jsc files, enabling source code protection. Current stable version is 1.5.7, with irregular releases. Key differentiators: it compiles to actual V8 bytecode (not just obfuscation), supports Electron and NW.js, provides both CLI and programmatic API, and has TypeScript type definitions. Known limitations include incompatibility with arrow functions in certain contexts and breaking code that depends on Function.prototype.toString.

npm install bytenode
INSTALL
IMPORT
SIG · BYTENODE
B
bytenode
devopsjavascriptv1.5.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compileCode
import { compileCode } from 'bytenode'
const bytenode = require('bytenode'); bytenode.compileCode(...)
ESM named import; CJS require works but destructure recommended.
compileFile
import { compileFile } from 'bytenode'
const compileFile = require('bytenode/compileFile')
File compiling function; direct path import is incorrect.
runBytecode
import { runBytecode } from 'bytenode'
Executes compiled bytecode buffer.
default
import bytenode from 'bytenode'
const bytenode = require('bytenode').default
Default export is an object with all functions; directly usable.

Compiles a JavaScript file to bytecode and then loads and executes the bytecode.

import { compileFile, runBytecode } from 'bytenode'; import fs from 'fs'; // Compile a JavaScript file await compileFile({ filename: 'app.js', output: 'app.jsc' }); // Read the bytecode file and run it const bytecode = fs.readFileSync('app.jsc'); runBytecode(bytecode);
bytenode --version
Debug
Known issues
breakingIn Node 10.x, Bytenode does not work in debug mode.
fix
Do not use Node 10.x with --inspect flag; upgrade to Node 12+.
affects: >=1.0.0
breakingArrow functions (especially async) cause crashes in Puppeteer, Electron, and ndb debugger.
fix
Avoid using arrow functions in compiled code; use regular function expressions instead.
affects: >=1.0.0
breakingCode relying on Function.prototype.toString will break because source code is removed from .jsc files.
fix
Replace any usage of .toString() on functions with alternative logic (e.g., store string representation elsewhere).
affects: >=1.0.0
deprecatedbytenode.runBytecode is not deprecated, but compileCode and compileFile may see argument changes in future versions.
fix
Watch changelog for updates to the API interface.
affects: >=1.3.0
Errors
Common errors & fixes
Cannot find module 'bytenode'
Package not installed or import path incorrect.
fix
Run npm install bytenode and ensure correct import syntax (e.g., import { compileCode } from 'bytenode').
TypeError: compileCode is not a function
Using default import and trying to call it directly.
fix
Use named import: import { compileCode } from 'bytenode'.
Uncaught Error: The module 'app.jsc' was compiled against a different Node.js version
Bytecode is version-specific; compiled on different Node.js major version.
fix
Recompile the .jsc file on the target Node.js version.
Upgrade
Version history
1.5.7latest on npm
Audit
Dependencies
commanderoptionalUsed for parsing CLI commands (required for CLI usage, optional for programmatic API)
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bytenode — npm install bytenode · libregistry