To upgrade:
bun upgrade
What's new:
You can now import
from "bun"
in bun.js. You can still use the global Bun
.
Before:
await Bun.write("output.txt", Bun.file("input.txt"))
After:
import {write, file} from 'bun';
await write("output.txt", file("input.txt"))
This isn't a breaking change – you can still use Bun's JavaScript printer replaces the Bun
as a global same as before.
How it works
"bun"
import specifier with globalThis.Bun
.
var {write, file} = globalThis.Bun;
await write("output.txt", file("input.txt"))
You'll probably want to update types too:
bun add bun-types
Bug fixes
- [fs] Add missing
isFile
andisDirectory
functions tofs.stat()
7cd3d13 - [js parser] Fix a code simplification bug that could happen when using
!
and comma operator - 4de7978 - [bun bun] Fix using
bun bun
with--platform=bun
set - 43b1866
Bug fixes from v0.0.77
- [bun dev] Fix race condition in file watcher
- [bun install] Fix falling back to copyfile when hardlink fails on linux due to differing filesystems - 74309a1
- [Bun.serve] When a
Bun.file
is not found and the error handler is not run, the default status code is now 404 - [Bun.serve] Fix hanging when
Bun.file
sent with sendfile and the request aborts or errors - [Bun.serve] Decrement the reference count for
FileBlob
sent via sendfile after the callback completes instead of before - [Bun.serve] Serve
.ts
and.tsx
files withtext/javascript
mime type by default instead of MPEG2 Video