diff --git a/docs/api/binary-data.md b/docs/api/binary-data.md index bd9bed578b..b830f9cb24 100644 --- a/docs/api/binary-data.md +++ b/docs/api/binary-data.md @@ -420,6 +420,8 @@ console.log(buf.toString()); // => Hello world ``` +`Buffer.prototype.toLocaleString` is an alias for `Buffer.prototype.toString`. + For complete documentation, refer to the [Node.js documentation](https://nodejs.org/api/buffer.html). ## `Blob` diff --git a/docs/api/s3.md b/docs/api/s3.md index 68dae77a39..04bf82e690 100644 --- a/docs/api/s3.md +++ b/docs/api/s3.md @@ -232,6 +232,9 @@ const url = s3file.presign({ // HTTP method method: "PUT", + + // S3 storage class (optional) + storageClass: "GLACIER_IR", }); ``` @@ -250,6 +253,23 @@ const url = s3file.presign({ }); ``` +### `storageClass` + +To set the S3 storage class for a presigned URL, pass the `storageClass` option. This lets you optimize for cost or latency by configuring how S3 stores objects. + +```ts +const url = s3file.presign({ + storageClass: "GLACIER_IR", + // storageClass: "STANDARD", + // storageClass: "REDUCED_REDUNDANCY", + // storageClass: "STANDARD_IA", + // storageClass: "ONEZONE_IA", + // storageClass: "INTELLIGENT_TIERING", + // storageClass: "GLACIER", + // storageClass: "DEEP_ARCHIVE", +}); +``` + ### `new Response(S3File)` To quickly redirect users to a presigned URL for an S3 file, pass an `S3File` instance to a `Response` object as the body. diff --git a/docs/api/udp.md b/docs/api/udp.md index e5d58323d1..6b732d6918 100644 --- a/docs/api/udp.md +++ b/docs/api/udp.md @@ -18,6 +18,18 @@ const socket = await Bun.udpSocket({ console.log(socket.port); // 41234 ``` +Enable address and port reuse: + +```ts +const socket = await Bun.udpSocket({ + port: 8000, + reuseAddr: true, // Allow reusing address + reusePort: true, // Enable load balancing on Linux +}); +``` + +The `reusePort` option enables load balancing between multiple processes on Linux. On other platforms, `reuseAddr` allows reusing an address that is already in use. + ### Send a datagram Specify the data to send, as well as the destination port and address. diff --git a/docs/bundler/fullstack.md b/docs/bundler/fullstack.md index 16ed1d8402..ded68fcacd 100644 --- a/docs/bundler/fullstack.md +++ b/docs/bundler/fullstack.md @@ -340,6 +340,8 @@ $ bun add bun-plugin-tailwind ```toml#bunfig.toml [serve.static] plugins = ["bun-plugin-tailwind"] +# Optionally disable minification +# minify = false ``` This will allow you to use TailwindCSS utility classes in your HTML and CSS files. All you need to do is import `tailwindcss` somewhere: @@ -376,6 +378,21 @@ Bun will lazily resolve and load each plugin and use them to bundle your routes. Note: this is currently in `bunfig.toml` to make it possible to know statically which plugins are in use when we eventually integrate this with the `bun build` CLI. These plugins work in `Bun.build()`'s JS API, but are not yet supported in the CLI. +### Minification + +Control minification of HTML imports via `bunfig.toml`: + +```toml#bunfig.toml +[serve.static] +minify = false +# or granular control: +# minify.whitespace = false +# minify.identifiers = false +# minify.syntax = false +``` + +By default, minification is enabled when `development: false` and disabled when `development: true`. + ## How this works Bun uses [`HTMLRewriter`](/docs/api/html-rewriter) to scan for `