Skip to main content
Porffor provides a powerful command-line interface for compiling and running JavaScript and TypeScript code.

Installation

Install Porffor globally via npm:
npm install -g porffor@latest

Basic Usage

porf <command> [...flags] path/to/script.js [...args]

Available Commands

Compile Commands

Run

Compile and execute JavaScript files

Wasm

Compile to WebAssembly binary

Native

Compile to native executable

C

Compile to C source code

Lambda

Compile to AWS Lambda deployment package

Analyze Commands

Profile

View detailed function-by-function performance

Debug

Debug JavaScript source with interactive debugger

Interactive Mode

REPL

Interactive Read-Eval-Print Loop

Global Flags

These flags work across all commands:
-On
flag
Optimization level. Use -O0, -O1 (default), -O2, or -O3
  • -O0: Disable optimizations
  • -O1: Basic optimizations (simplify instructions, treeshake Wasm imports)
  • -O2: Advanced optimizations (partial evaluation) - unstable
  • -O3: Maximum optimizations
-t
flag
Force parsing input as TypeScript
-d
flag
Debug mode - includes names in Wasm output and enables debug logs
--module
flag
Parse input as an ES module
--secure
flag
Secure mode - errors on unsafe Porffor features (e.g., FFI)
--parser
string
default:"acorn"
Parser to use: acorn, @babel/parser, meriyah, or hermes-parser
--parse-types
flag
Enable parsing TypeScript type annotations. If --parser is unset, defaults to @babel/parser
--opt-types
flag
Use type annotations as compiler hints for optimization (does not type check)
--valtype
string
default:"f64"
Value type to use: i32 or f64

Advanced Flags

View all flags including experimental options:
porf --help all
-f
flag
Print disassembled Wasm generated from user functions
--pgo
flag
Enable profile-guided optimization
--no-coctc
flag
Disable COCTC (cross-object compile-time cache)
--cyclone
flag
Enable experimental Cyclone optimizer
--no-treeshake-wasm-imports
flag
Do not treeshake Wasm imports
--allocator
string
default:"chunk"
Memory allocator: oneshot or chunk
--exception-mode
string
default:"stack"
Exception handling mode: lut or stack
--fast-length
flag
Non-compliant optimization to make .length faster
--profile-compiler
flag
Log general compiler performance (enabled by default when compiling to file)
--prng
string
default:"xorshift128+"
PRNG algorithm: xorshift32+, xorshift64+, xorshift128+, xoroshiro128+, or xoshiro128+

Getting Help

# Show basic help
porf --help
porf -h

# Show all flags including advanced options
porf --help all

# Show version
porf --version
porf -v

Running Code

porf script.js

Next Steps

Run Command

Learn about executing JavaScript files

Compile to Wasm

Build WebAssembly binaries

Profile Code

Analyze performance

REPL Mode

Interactive development

Build docs developers (and LLMs) love