{% callout %} **Note** — `bunx` is an alias for `bun x`. The `bunx` CLI will be auto-installed when you install `bun`. {% /callout %} Use `bunx` to auto-install and run packages from `npm`. It's Bun's equivalent of `npx` or `yarn dlx`. ```bash $ bunx cowsay "Hello world!" ``` {% callout %} ⚡️ **Speed** — With Bun's fast startup times, `bunx` is [roughly 100x faster](https://twitter.com/jarredsumner/status/1606163655527059458) than `npx` for locally installed packages. {% /callout %} Packages can declare executables in the `"bin"` field of their `package.json`. These are known as _package executables_ or _package binaries_. ```jsonc#package.json { // ... other fields "name": "my-cli", "bin": { "my-cli": "dist/index.js" } } ``` These executables are commonly plain JavaScript files marked with a [shebang line]() to indicate which program should be used to execute them. The following file indicates that it should be executed with `node`. ```js#dist/index.js #!/usr/bin/env node console.log("Hello world!"); ``` These executables can be run with `bunx`, ```bash $ bunx my-cli ``` As with `npx`, `bunx` will check for a locally installed package first, then fall back to auto-installing the package from `npm`. Installed packages will be stored in Bun's global cache for future use. ## Arguments and flags To pass additional command-line flags and arguments through to the executable, place them after the executable name. ```bash $ bunx my-cli --foo bar ``` ## Shebangs By default, Bun respects shebangs. If an executable is marked with `#!/usr/bin/env node`, Bun will spin up a `node` process to execute the file. However, in some cases it may be desirable to run executables using Bun's runtime, even if the executable indicates otherwise. To do so, include the `--bun` flag. ```bash $ bunx --bun my-cli ``` The `--bun` flag must occur _before_ the executable name. Flags that appear _after_ the name are passed through to the executable. ```bash $ bunx --bun my-cli # good $ bunx my-cli --bun # bad ``` > Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/test/snippets/unicode-identifiers.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-12-04content-range is inclusiveGravatar Jarred Sumner 1-1/+1
2022-12-04Update README.mdGravatar Jarred Sumner 1-6/+33
2022-12-04[Bun.serve] Implement `Content-Range` support with `Bun.file()`Gravatar Jarred Sumner 5-16/+286
2022-12-04[may revert later] Coerce Infinity to max int 64, -Infinity & NaN to min int64Gravatar Jarred Sumner 1-2/+22
2022-12-03Update .gitignoreGravatar Jarred Sumner 1-0/+1
2022-12-03[test] Add a couple tests for subarray toEqualGravatar Jarred Sumner 1-0/+3
2022-12-03[fetch] Fix bug where .arrayBuffer() on an empty Response body returned a `Ui...Gravatar Jarred Sumner 1-1/+1
2022-12-03Don't invalidate previous file descriptro to avoid tripping assertionGravatar Jarred Sumner 1-5/+0
2022-12-03miscGravatar Jarred Sumner 3-1/+31
2022-12-03Add missing typeGravatar Jarred Sumner 1-0/+5
2022-12-03`process.stdout` and `process.stderr`Gravatar Jarred Sumner 15-564/+1537
2022-12-03simdutf ascii validation is about 20% faster on arm64 than our zig simd @Vect...Gravatar Jarred Sumner 1-0/+3
2022-12-03typo in readme (#1576)Gravatar Reed Jones 1-2/+2