Skip to content

LLM Resources

📈 usage

Below is a sample of the many ways to run binarium.

📦 JS

Quickly compile your JS project into executables for all platforms and architectures

Automatically detects the JS runtime you are working in. Only accepts node, deno, bun

ts
import { 
build
} from 'binarium'
await
build
( {
input
: 'src/cli.js', // JS or TS file. You can add it without the extension
name
: 'app-name', // default is input filename
} )

🟢 Node

Quickly compile your Node project into executables for all platforms and architectures

js
import { 
buildNode
} from 'binarium'
await
buildNode
( {
input
: 'src/cli', // JS or TS file. You can add it without the extension
name
: 'app-name', // default is input filename
} )

This function works thanks to ncc, pkg and esbuild, which facilitate this process.

Alternatively, if you are working in a node environment, you can do:

js
import { 
build
} from 'binarium'
await
build
( {
input
: 'src/cli', // JS or TS file. You can add it without the extension
name
: 'app-name', // default is input filename
} )

🦕 Deno

Build Deno executables (deno compile wrapper)

js
import { 
buildDeno
} from 'binarium'
await
buildDeno
( {
input
: 'src/cli', // JS or TS file. You can add it without the extension
name
: 'app-name', // default is input filename
} )

🍞 Bun

Build Bun executables (bun build --compile wrapper)

js
import { 
buildBun
} from 'binarium'
await
buildBun
( {
input
: 'src/cli', // JS or TS file. You can add it without the extension
name
: 'app-name', // default is input filename
} )

💻 CLI

Use it from Cli.

bash
binarium --input src/server.js --name app-name
bash
binarium node --input src/node-server.js --name node-app-name
bash
binarium deno --input src/deno-server.js --name deno-app-name
bash
binarium bun --input src/bun-server.js --name bun-app-name

🛠️ With config file - advanced configuration

For more advanced configuration you can use a configuration file. Supported formats are: .mjs, .js, .json, .yml, .yaml, .toml, .tml.

In the configuration file you can define your build options and configure advanced options of the build itself using the nodeOptions|denoOptions|bunOptions key.

Node Example

bash
binarium node --config binarium.config.js
js
// binarium.config.js
import { 
defineConfig
} from 'binarium'
export default
defineConfig
( {
name
: 'my-app-name',
onlyOs
: true,
nodeOptions
: {
esbuild
: {
tsconfig
: './tsconfig.builder.json' } },
} )

Deno Example

bash
binarium deno -c binarium.config.js
js
// binarium.config.js
import { 
defineConfig
} from 'binarium'
export default
defineConfig
( {
name
: 'my-app-name',
onlyOs
: true,
denoOptions
: {
flags
: [ '--allow-all', '--no-npm' ] },
} )

Bun Example

bash
binarium bun -c binarium.config.js
js
// binarium.config.js
import { 
defineConfig
} from 'binarium'
export default
defineConfig
( {
name
: 'my-app-name',
onlyOs
: true,
bunOptions
: {
flags
: [ '--packages external' ] },
} )