mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
add .bytes() method to various readables (#11104)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: nektro <nektro@users.noreply.github.com>
This commit is contained in:
@@ -275,6 +275,7 @@ Bun.stringWidth("\u001b[31mhello\u001b[0m", { countAnsiEscapeCodes: true }); //
|
||||
```
|
||||
|
||||
This is useful for:
|
||||
|
||||
- Aligning text in a terminal
|
||||
- Quickly checking if a string contains ANSI escape codes
|
||||
- Measuring the width of a string in a terminal
|
||||
@@ -372,7 +373,6 @@ npm/string-width 95,000 chars ansi+emoji+ascii 3.68 s/iter (3.66 s
|
||||
|
||||
{% /details %}
|
||||
|
||||
|
||||
TypeScript definition:
|
||||
|
||||
```ts
|
||||
@@ -400,7 +400,6 @@ namespace Bun {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
<!-- ## `Bun.enableANSIColors()` -->
|
||||
|
||||
## `Bun.fileURLToPath()`
|
||||
@@ -603,6 +602,9 @@ stream; // => ReadableStream
|
||||
await Bun.readableStreamToArrayBuffer(stream);
|
||||
// => ArrayBuffer
|
||||
|
||||
await Bun.readableStreamToBytes(stream);
|
||||
// => Uint8Array
|
||||
|
||||
await Bun.readableStreamToBlob(stream);
|
||||
// => Blob
|
||||
|
||||
|
||||
Reference in New Issue
Block a user