bun-types 1.2.8-canary.20250330T140625 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.d.ts +27 -15
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/cli/publish.md +1 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/install/add-peer.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/version.md +1 -1
- package/docs/installation.md +4 -4
- package/docs/runtime/debugger.md +3 -3
- package/docs/test/dom.md +1 -1
- package/globals.d.ts +7 -9
- package/overrides.d.ts +2 -0
- package/package.json +1 -1
- package/s3.d.ts +25 -25
package/bun.d.ts
CHANGED
|
@@ -510,7 +510,7 @@ declare module "bun" {
|
|
|
510
510
|
threadId: number;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
interface Env
|
|
513
|
+
interface Env {
|
|
514
514
|
NODE_ENV?: string;
|
|
515
515
|
/**
|
|
516
516
|
* Can be used to change the default timezone at runtime
|
|
@@ -525,7 +525,7 @@ declare module "bun" {
|
|
|
525
525
|
*
|
|
526
526
|
* Changes to `process.env` at runtime won't automatically be reflected in the default value. For that, you can pass `process.env` explicitly.
|
|
527
527
|
*/
|
|
528
|
-
const env: Env;
|
|
528
|
+
const env: Env & NodeJS.ProcessEnv;
|
|
529
529
|
|
|
530
530
|
/**
|
|
531
531
|
* The raw arguments passed to the process, including flags passed to Bun. If you want to easily read flags passed to your script, consider using `process.argv` instead.
|
|
@@ -3061,8 +3061,6 @@ declare module "bun" {
|
|
|
3061
3061
|
/**
|
|
3062
3062
|
* A fast WebSocket designed for servers.
|
|
3063
3063
|
*
|
|
3064
|
-
* @category HTTP & Networking
|
|
3065
|
-
*
|
|
3066
3064
|
* Features:
|
|
3067
3065
|
* - **Message compression** - Messages can be compressed
|
|
3068
3066
|
* - **Backpressure** - If the client is not ready to receive data, the server will tell you.
|
|
@@ -3074,9 +3072,7 @@ declare module "bun" {
|
|
|
3074
3072
|
* Powered by [uWebSockets](https://github.com/uNetworking/uWebSockets).
|
|
3075
3073
|
*
|
|
3076
3074
|
* @example
|
|
3077
|
-
*
|
|
3078
|
-
*
|
|
3079
|
-
* serve({
|
|
3075
|
+
* Bun.serve({
|
|
3080
3076
|
* websocket: {
|
|
3081
3077
|
* open(ws) {
|
|
3082
3078
|
* console.log("Connected", ws.remoteAddress);
|
|
@@ -3090,6 +3086,8 @@ declare module "bun" {
|
|
|
3090
3086
|
* },
|
|
3091
3087
|
* }
|
|
3092
3088
|
* });
|
|
3089
|
+
*
|
|
3090
|
+
* @category HTTP & Networking
|
|
3093
3091
|
*/
|
|
3094
3092
|
interface ServerWebSocket<T = undefined> {
|
|
3095
3093
|
/**
|
|
@@ -3698,8 +3696,7 @@ declare module "bun" {
|
|
|
3698
3696
|
*
|
|
3699
3697
|
* @example
|
|
3700
3698
|
* ```js
|
|
3701
|
-
*
|
|
3702
|
-
* serve({
|
|
3699
|
+
* Bun.serve({
|
|
3703
3700
|
* websocket: {
|
|
3704
3701
|
* open: (ws) => {
|
|
3705
3702
|
* console.log("Client connected");
|
|
@@ -4040,13 +4037,13 @@ declare module "bun" {
|
|
|
4040
4037
|
*
|
|
4041
4038
|
* To start the server, see {@link serve}
|
|
4042
4039
|
*
|
|
4043
|
-
* @category HTTP & Networking
|
|
4044
|
-
*
|
|
4045
4040
|
* For performance, Bun pre-allocates most of the data for 2048 concurrent requests.
|
|
4046
4041
|
* That means starting a new server allocates about 500 KB of memory. Try to
|
|
4047
4042
|
* avoid starting and stopping the server often (unless it's a new instance of bun).
|
|
4048
4043
|
*
|
|
4049
|
-
* Powered by a fork of [uWebSockets](https://github.com/uNetworking/uWebSockets). Thank you
|
|
4044
|
+
* Powered by a fork of [uWebSockets](https://github.com/uNetworking/uWebSockets). Thank you \@alexhultman.
|
|
4045
|
+
*
|
|
4046
|
+
* @category HTTP & Networking
|
|
4050
4047
|
*/
|
|
4051
4048
|
interface Server extends Disposable {
|
|
4052
4049
|
/**
|
|
@@ -4261,15 +4258,30 @@ declare module "bun" {
|
|
|
4261
4258
|
|
|
4262
4259
|
readonly url: URL;
|
|
4263
4260
|
|
|
4264
|
-
readonly port: number;
|
|
4265
4261
|
/**
|
|
4266
|
-
* The
|
|
4262
|
+
* The port the server is listening on.
|
|
4263
|
+
*
|
|
4264
|
+
* This will be undefined when the server is listening on a unix socket.
|
|
4265
|
+
*
|
|
4266
|
+
* @example
|
|
4267
|
+
* ```js
|
|
4268
|
+
* 3000
|
|
4269
|
+
* ```
|
|
4270
|
+
*/
|
|
4271
|
+
readonly port: number | undefined;
|
|
4272
|
+
|
|
4273
|
+
/**
|
|
4274
|
+
* The hostname the server is listening on. Does not include the port.
|
|
4275
|
+
*
|
|
4276
|
+
* This will be `undefined` when the server is listening on a unix socket.
|
|
4277
|
+
*
|
|
4267
4278
|
* @example
|
|
4268
4279
|
* ```js
|
|
4269
4280
|
* "localhost"
|
|
4270
4281
|
* ```
|
|
4271
4282
|
*/
|
|
4272
|
-
readonly hostname: string;
|
|
4283
|
+
readonly hostname: string | undefined;
|
|
4284
|
+
|
|
4273
4285
|
/**
|
|
4274
4286
|
* Is the server running in development mode?
|
|
4275
4287
|
*
|
package/docs/api/fetch.md
CHANGED
|
@@ -337,7 +337,7 @@ This will print the request and response headers to your terminal:
|
|
|
337
337
|
```sh
|
|
338
338
|
[fetch] > HTTP/1.1 GET http://example.com/
|
|
339
339
|
[fetch] > Connection: keep-alive
|
|
340
|
-
[fetch] > User-Agent: Bun/1.2.8
|
|
340
|
+
[fetch] > User-Agent: Bun/1.2.8
|
|
341
341
|
[fetch] > Accept: */*
|
|
342
342
|
[fetch] > Host: example.com
|
|
343
343
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/api/spawn.md
CHANGED
|
@@ -120,7 +120,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
|
|
|
120
120
|
```ts
|
|
121
121
|
const proc = Bun.spawn(["bun", "--version"]);
|
|
122
122
|
const text = await new Response(proc.stdout).text();
|
|
123
|
-
console.log(text); // => "1.2.8
|
|
123
|
+
console.log(text); // => "1.2.8"
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Configure the output stream by passing one of the following values to `stdout/stderr`:
|
package/docs/cli/publish.md
CHANGED
|
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
|
|
|
9
9
|
✔ Which package manager would you like to use?
|
|
10
10
|
bun
|
|
11
11
|
◐ Installing dependencies...
|
|
12
|
-
bun install v1.2.8
|
|
12
|
+
bun install v1.2.8 (16b4bf34)
|
|
13
13
|
+ @nuxt/devtools@0.8.2
|
|
14
14
|
+ nuxt@3.7.0
|
|
15
15
|
785 packages installed [2.67s]
|
|
@@ -16,7 +16,7 @@ This will add the package to `peerDependencies` in `package.json`.
|
|
|
16
16
|
```json-diff
|
|
17
17
|
{
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
+ "@types/bun": "^1.2.8
|
|
19
|
+
+ "@types/bun": "^1.2.8"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
```
|
|
@@ -28,7 +28,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
|
|
|
28
28
|
```json-diff
|
|
29
29
|
{
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@types/bun": "^1.2.8
|
|
31
|
+
"@types/bun": "^1.2.8"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
+ "@types/bun": {
|
|
@@ -97,7 +97,7 @@ $ bun update
|
|
|
97
97
|
$ bun update @types/bun --latest
|
|
98
98
|
|
|
99
99
|
# Update a dependency to a specific version
|
|
100
|
-
$ bun update @types/bun@1.2.8
|
|
100
|
+
$ bun update @types/bun@1.2.8
|
|
101
101
|
|
|
102
102
|
# Update all dependencies to the latest versions
|
|
103
103
|
$ bun update --latest
|
|
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
|
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
$ bun test
|
|
24
|
-
bun test v1.2.8
|
|
24
|
+
bun test v1.2.8 (9c68abdb)
|
|
25
25
|
|
|
26
26
|
test.test.js:
|
|
27
27
|
✓ add [0.87ms]
|
|
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
|
|
|
47
47
|
|
|
48
48
|
```sh
|
|
49
49
|
$ bun test test3
|
|
50
|
-
bun test v1.2.8
|
|
50
|
+
bun test v1.2.8 (9c68abdb)
|
|
51
51
|
|
|
52
52
|
test3.test.js:
|
|
53
53
|
✓ add [1.40ms]
|
|
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
|
|
|
85
85
|
|
|
86
86
|
```sh
|
|
87
87
|
$ bun test -t add
|
|
88
|
-
bun test v1.2.8
|
|
88
|
+
bun test v1.2.8 (9c68abdb)
|
|
89
89
|
|
|
90
90
|
test.test.js:
|
|
91
91
|
✓ add [1.79ms]
|
|
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
$ bun test test/snap
|
|
21
|
-
bun test v1.2.8
|
|
21
|
+
bun test v1.2.8 (9c68abdb)
|
|
22
22
|
|
|
23
23
|
test/snap.test.ts:
|
|
24
24
|
✓ snapshot [1.48ms]
|
|
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
|
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
63
|
$ bun test
|
|
64
|
-
bun test v1.2.8
|
|
64
|
+
bun test v1.2.8 (9c68abdb)
|
|
65
65
|
|
|
66
66
|
test/snap.test.ts:
|
|
67
67
|
✓ snapshot [1.05ms]
|
|
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
|
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
80
|
$ bun test --update-snapshots
|
|
81
|
-
bun test v1.2.8
|
|
81
|
+
bun test v1.2.8 (9c68abdb)
|
|
82
82
|
|
|
83
83
|
test/snap.test.ts:
|
|
84
84
|
✓ snapshot [0.86ms]
|
package/docs/installation.md
CHANGED
|
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
|
|
|
14
14
|
```bash#macOS/Linux_(curl)
|
|
15
15
|
$ curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
|
|
16
16
|
# to install a specific version
|
|
17
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8"
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
```bash#npm
|
|
@@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
|
|
|
189
189
|
|
|
190
190
|
### Installing a specific version of Bun on Linux/Mac
|
|
191
191
|
|
|
192
|
-
To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.8
|
|
192
|
+
To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.8`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8"
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
### Installing a specific version of Bun on Windows
|
|
@@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num
|
|
|
201
201
|
|
|
202
202
|
```sh
|
|
203
203
|
# PowerShell:
|
|
204
|
-
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.8
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.8"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
package/docs/runtime/debugger.md
CHANGED
|
@@ -124,11 +124,11 @@ await fetch("https://example.com", {
|
|
|
124
124
|
This prints the `fetch` request as a single-line `curl` command to let you copy-paste into your terminal to replicate the request.
|
|
125
125
|
|
|
126
126
|
```sh
|
|
127
|
-
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.8
|
|
127
|
+
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.8" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
|
|
128
128
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
129
129
|
[fetch] > content-type: application/json
|
|
130
130
|
[fetch] > Connection: keep-alive
|
|
131
|
-
[fetch] > User-Agent: Bun/1.2.8
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.8
|
|
132
132
|
[fetch] > Accept: */*
|
|
133
133
|
[fetch] > Host: example.com
|
|
134
134
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -170,7 +170,7 @@ This prints the following to the console:
|
|
|
170
170
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
171
171
|
[fetch] > content-type: application/json
|
|
172
172
|
[fetch] > Connection: keep-alive
|
|
173
|
-
[fetch] > User-Agent: Bun/1.2.8
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.8
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/test/dom.md
CHANGED
package/globals.d.ts
CHANGED
|
@@ -16,15 +16,11 @@ declare module "bun" {
|
|
|
16
16
|
|
|
17
17
|
type LibEmptyOrNodeUtilTextDecoder = LibDomIsLoaded extends true ? {} : import("util").TextDecoder;
|
|
18
18
|
|
|
19
|
-
type LibEmptyOrNodeReadableStream<T
|
|
20
|
-
? {}
|
|
21
|
-
: import("stream/web").ReadableStream<T>;
|
|
19
|
+
type LibEmptyOrNodeReadableStream<T> = LibDomIsLoaded extends true ? {} : import("stream/web").ReadableStream<T>;
|
|
22
20
|
|
|
23
|
-
type LibEmptyOrNodeWritableStream<T
|
|
24
|
-
? {}
|
|
25
|
-
: import("stream/web").WritableStream<T>;
|
|
21
|
+
type LibEmptyOrNodeWritableStream<T> = LibDomIsLoaded extends true ? {} : import("stream/web").WritableStream<T>;
|
|
26
22
|
|
|
27
|
-
type LibEmptyOrNodeTransformStream<I
|
|
23
|
+
type LibEmptyOrNodeTransformStream<I, O> = LibDomIsLoaded extends true
|
|
28
24
|
? {}
|
|
29
25
|
: import("stream/web").TransformStream<I, O>;
|
|
30
26
|
|
|
@@ -32,7 +28,7 @@ declare module "bun" {
|
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
interface ReadableStream<R = any> extends Bun.__internal.LibEmptyOrNodeReadableStream {}
|
|
31
|
+
interface ReadableStream<R = any> extends Bun.__internal.LibEmptyOrNodeReadableStream<R> {}
|
|
36
32
|
declare var ReadableStream: Bun.__internal.UseLibDomIfAvailable<
|
|
37
33
|
"ReadableStream",
|
|
38
34
|
{
|
|
@@ -42,7 +38,7 @@ declare var ReadableStream: Bun.__internal.UseLibDomIfAvailable<
|
|
|
42
38
|
}
|
|
43
39
|
>;
|
|
44
40
|
|
|
45
|
-
interface WritableStream<W = any> extends Bun.__internal.LibEmptyOrNodeWritableStream {}
|
|
41
|
+
interface WritableStream<W = any> extends Bun.__internal.LibEmptyOrNodeWritableStream<W> {}
|
|
46
42
|
declare var WritableStream: Bun.__internal.UseLibDomIfAvailable<
|
|
47
43
|
"WritableStream",
|
|
48
44
|
{
|
|
@@ -1750,6 +1746,8 @@ interface BunFetchRequestInit extends RequestInit {
|
|
|
1750
1746
|
* Override the default S3 options
|
|
1751
1747
|
*/
|
|
1752
1748
|
s3?: Bun.S3Options;
|
|
1749
|
+
|
|
1750
|
+
unix?: string;
|
|
1753
1751
|
}
|
|
1754
1752
|
|
|
1755
1753
|
/**
|
package/overrides.d.ts
CHANGED
package/package.json
CHANGED
package/s3.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ declare module "bun" {
|
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* // Setting public read access
|
|
93
|
-
* const file = s3("public-file.txt", {
|
|
93
|
+
* const file = s3.file("public-file.txt", {
|
|
94
94
|
* acl: "public-read",
|
|
95
95
|
* bucket: "my-bucket"
|
|
96
96
|
* });
|
|
@@ -113,24 +113,24 @@ declare module "bun" {
|
|
|
113
113
|
| "log-delivery-write";
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
* The S3 bucket name.
|
|
116
|
+
* The S3 bucket name. Defaults to `S3_BUCKET` or `AWS_BUCKET` environment variables.
|
|
117
117
|
*
|
|
118
118
|
* @example
|
|
119
119
|
* // Using explicit bucket
|
|
120
|
-
* const file = s3("my-file.txt", { bucket: "my-bucket" });
|
|
120
|
+
* const file = s3.file("my-file.txt", { bucket: "my-bucket" });
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
123
|
* // Using environment variables
|
|
124
124
|
* // With S3_BUCKET=my-bucket in .env
|
|
125
|
-
* const file = s3("my-file.txt");
|
|
125
|
+
* const file = s3.file("my-file.txt");
|
|
126
126
|
*/
|
|
127
127
|
bucket?: string;
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* The AWS region.
|
|
130
|
+
* The AWS region. Defaults to `S3_REGION` or `AWS_REGION` environment variables.
|
|
131
131
|
*
|
|
132
132
|
* @example
|
|
133
|
-
* const file = s3("my-file.txt", {
|
|
133
|
+
* const file = s3.file("my-file.txt", {
|
|
134
134
|
* bucket: "my-bucket",
|
|
135
135
|
* region: "us-west-2"
|
|
136
136
|
* });
|
|
@@ -139,23 +139,23 @@ declare module "bun" {
|
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* The access key ID for authentication.
|
|
142
|
-
*
|
|
142
|
+
* Defaults to `S3_ACCESS_KEY_ID` or `AWS_ACCESS_KEY_ID` environment variables.
|
|
143
143
|
*/
|
|
144
144
|
accessKeyId?: string;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* The secret access key for authentication.
|
|
148
|
-
*
|
|
148
|
+
* Defaults to `S3_SECRET_ACCESS_KEY` or `AWS_SECRET_ACCESS_KEY` environment variables.
|
|
149
149
|
*/
|
|
150
150
|
secretAccessKey?: string;
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Optional session token for temporary credentials.
|
|
154
|
-
*
|
|
154
|
+
* Defaults to `S3_SESSION_TOKEN` or `AWS_SESSION_TOKEN` environment variables.
|
|
155
155
|
*
|
|
156
156
|
* @example
|
|
157
157
|
* // Using temporary credentials
|
|
158
|
-
* const file = s3("my-file.txt", {
|
|
158
|
+
* const file = s3.file("my-file.txt", {
|
|
159
159
|
* accessKeyId: tempAccessKey,
|
|
160
160
|
* secretAccessKey: tempSecretKey,
|
|
161
161
|
* sessionToken: tempSessionToken
|
|
@@ -165,29 +165,29 @@ declare module "bun" {
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* The S3-compatible service endpoint URL.
|
|
168
|
-
*
|
|
168
|
+
* Defaults to `S3_ENDPOINT` or `AWS_ENDPOINT` environment variables.
|
|
169
169
|
*
|
|
170
170
|
* @example
|
|
171
171
|
* // AWS S3
|
|
172
|
-
* const file = s3("my-file.txt", {
|
|
172
|
+
* const file = s3.file("my-file.txt", {
|
|
173
173
|
* endpoint: "https://s3.us-east-1.amazonaws.com"
|
|
174
174
|
* });
|
|
175
175
|
*
|
|
176
176
|
* @example
|
|
177
177
|
* // Cloudflare R2
|
|
178
|
-
* const file = s3("my-file.txt", {
|
|
178
|
+
* const file = s3.file("my-file.txt", {
|
|
179
179
|
* endpoint: "https://<account-id>.r2.cloudflarestorage.com"
|
|
180
180
|
* });
|
|
181
181
|
*
|
|
182
182
|
* @example
|
|
183
183
|
* // DigitalOcean Spaces
|
|
184
|
-
* const file = s3("my-file.txt", {
|
|
184
|
+
* const file = s3.file("my-file.txt", {
|
|
185
185
|
* endpoint: "https://<region>.digitaloceanspaces.com"
|
|
186
186
|
* });
|
|
187
187
|
*
|
|
188
188
|
* @example
|
|
189
189
|
* // MinIO (local development)
|
|
190
|
-
* const file = s3("my-file.txt", {
|
|
190
|
+
* const file = s3.file("my-file.txt", {
|
|
191
191
|
* endpoint: "http://localhost:9000"
|
|
192
192
|
* });
|
|
193
193
|
*/
|
|
@@ -198,7 +198,7 @@ declare module "bun" {
|
|
|
198
198
|
*
|
|
199
199
|
* @example
|
|
200
200
|
* // Using virtual hosted style
|
|
201
|
-
* const file = s3("my-file.txt", {
|
|
201
|
+
* const file = s3.file("my-file.txt", {
|
|
202
202
|
* virtualHostedStyle: true,
|
|
203
203
|
* endpoint: "https://my-bucket.s3.us-east-1.amazonaws.com"
|
|
204
204
|
* });
|
|
@@ -213,7 +213,7 @@ declare module "bun" {
|
|
|
213
213
|
*
|
|
214
214
|
* @example
|
|
215
215
|
* // Configuring multipart uploads
|
|
216
|
-
* const file = s3("large-file.dat", {
|
|
216
|
+
* const file = s3.file("large-file.dat", {
|
|
217
217
|
* partSize: 10 * 1024 * 1024, // 10 MiB parts
|
|
218
218
|
* queueSize: 4 // Upload 4 parts in parallel
|
|
219
219
|
* });
|
|
@@ -240,7 +240,7 @@ declare module "bun" {
|
|
|
240
240
|
*
|
|
241
241
|
* @example
|
|
242
242
|
* // Setting retry attempts
|
|
243
|
-
* const file = s3("my-file.txt", {
|
|
243
|
+
* const file = s3.file("my-file.txt", {
|
|
244
244
|
* retry: 5 // Retry failed uploads up to 5 times
|
|
245
245
|
* });
|
|
246
246
|
*/
|
|
@@ -252,7 +252,7 @@ declare module "bun" {
|
|
|
252
252
|
*
|
|
253
253
|
* @example
|
|
254
254
|
* // Setting explicit content type
|
|
255
|
-
* const file = s3("data.bin", {
|
|
255
|
+
* const file = s3.file("data.bin", {
|
|
256
256
|
* type: "application/octet-stream"
|
|
257
257
|
* });
|
|
258
258
|
*/
|
|
@@ -263,7 +263,7 @@ declare module "bun" {
|
|
|
263
263
|
*
|
|
264
264
|
* @example
|
|
265
265
|
* // Setting explicit Storage class
|
|
266
|
-
* const file = s3("my-file.json", {
|
|
266
|
+
* const file = s3.file("my-file.json", {
|
|
267
267
|
* storageClass: "STANDARD_IA"
|
|
268
268
|
* });
|
|
269
269
|
*/
|
|
@@ -471,7 +471,7 @@ declare module "bun" {
|
|
|
471
471
|
* The name or path of the file in the bucket.
|
|
472
472
|
*
|
|
473
473
|
* @example
|
|
474
|
-
* const file = s3("folder/image.jpg");
|
|
474
|
+
* const file = s3.file("folder/image.jpg");
|
|
475
475
|
* console.log(file.name); // "folder/image.jpg"
|
|
476
476
|
*/
|
|
477
477
|
readonly name?: string;
|
|
@@ -480,7 +480,7 @@ declare module "bun" {
|
|
|
480
480
|
* The bucket name containing the file.
|
|
481
481
|
*
|
|
482
482
|
* @example
|
|
483
|
-
* const file = s3("s3://my-bucket/file.txt");
|
|
483
|
+
* const file = s3.file("s3://my-bucket/file.txt");
|
|
484
484
|
* console.log(file.bucket); // "my-bucket"
|
|
485
485
|
*/
|
|
486
486
|
readonly bucket?: string;
|
|
@@ -631,7 +631,7 @@ declare module "bun" {
|
|
|
631
631
|
* });
|
|
632
632
|
*
|
|
633
633
|
* // Get file instance
|
|
634
|
-
* const file = bucket("image.jpg");
|
|
634
|
+
* const file = bucket.file("image.jpg");
|
|
635
635
|
*
|
|
636
636
|
* // Common operations
|
|
637
637
|
* await bucket.write("data.json", JSON.stringify({hello: "world"}));
|
|
@@ -682,7 +682,7 @@ declare module "bun" {
|
|
|
682
682
|
* @example
|
|
683
683
|
* const file = bucket.file("image.jpg");
|
|
684
684
|
* await file.write(imageData);
|
|
685
|
-
* const configFile = bucket("config.json", {
|
|
685
|
+
* const configFile = bucket.file("config.json", {
|
|
686
686
|
* type: "application/json",
|
|
687
687
|
* acl: "private"
|
|
688
688
|
* });
|
|
@@ -797,7 +797,7 @@ declare module "bun" {
|
|
|
797
797
|
* @example
|
|
798
798
|
* // Check existence
|
|
799
799
|
* if (await bucket.exists("config.json")) {
|
|
800
|
-
* const file = bucket("config.json");
|
|
800
|
+
* const file = bucket.file("config.json");
|
|
801
801
|
* const config = await file.json();
|
|
802
802
|
* }
|
|
803
803
|
*
|