bun-types 1.2.16-canary.20250611T140555 → 1.2.16

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/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.16-canary.20250611T140555
340
+ [fetch] > User-Agent: Bun/1.2.16
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.16-canary.20250611T140555"
123
+ console.log(text); // => "1.2.16"
124
124
  ```
125
125
 
126
126
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -7,7 +7,7 @@ Use `bun publish` to publish a package to the npm registry.
7
7
  $ bun publish
8
8
 
9
9
  ## Output
10
- bun publish v1.2.16-canary.20250611T140555 (ca7428e9)
10
+ bun publish v1.2.16 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -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.16-canary.20250611T140555 (16b4bf34)
12
+ bun install v1.2.16 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -15,7 +15,7 @@ This will add the package to `peerDependencies` in `package.json`.
15
15
  ```json-diff
16
16
  {
17
17
  "peerDependencies": {
18
- + "@types/bun": "^1.2.16-canary.20250611T140555"
18
+ + "@types/bun": "^1.2.16"
19
19
  }
20
20
  }
21
21
  ```
@@ -27,7 +27,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
27
27
  ```json-diff
28
28
  {
29
29
  "peerDependencies": {
30
- "@types/bun": "^1.2.16-canary.20250611T140555"
30
+ "@types/bun": "^1.2.16"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  + "@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.16-canary.20250611T140555
100
+ $ bun update @types/bun@1.2.16
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.16-canary.20250611T140555 (9c68abdb)
24
+ bun test v1.2.16 (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.16-canary.20250611T140555 (9c68abdb)
50
+ bun test v1.2.16 (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.16-canary.20250611T140555 (9c68abdb)
88
+ bun test v1.2.16 (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.16-canary.20250611T140555 (9c68abdb)
21
+ bun test v1.2.16 (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.16-canary.20250611T140555 (9c68abdb)
64
+ bun test v1.2.16 (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.16-canary.20250611T140555 (9c68abdb)
81
+ bun test v1.2.16 (9c68abdb)
82
82
 
83
83
  test/snap.test.ts:
84
84
  ✓ snapshot [0.86ms]
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
29
29
 
30
30
  ```sh
31
31
  $ bun test --update-snapshots
32
- bun test v1.2.16-canary.20250611T140555 (9c68abdb)
32
+ bun test v1.2.16 (9c68abdb)
33
33
 
34
34
  test/snap.test.ts:
35
35
  ✓ snapshot [0.86ms]
@@ -5,7 +5,7 @@ name: Get the current Bun version
5
5
  Get the current version of Bun in a semver format.
6
6
 
7
7
  ```ts#index.ts
8
- Bun.version; // => "1.2.16-canary.20250611T140555"
8
+ Bun.version; // => "1.2.16"
9
9
  ```
10
10
 
11
11
  ---
@@ -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.16-canary.20250611T140555"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16"
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.16-canary.20250611T140555`.
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.16`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.20250611T140555"
195
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16"
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.16-canary.20250611T140555"
204
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.16"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -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.16-canary.20250611T140555" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
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.16" -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.16-canary.20250611T140555
131
+ [fetch] > User-Agent: Bun/1.2.16
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.16-canary.20250611T140555
173
+ [fetch] > User-Agent: Bun/1.2.16
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/test/dom.md CHANGED
@@ -55,7 +55,7 @@ Let's run this test with `bun test`:
55
55
 
56
56
  ```bash
57
57
  $ bun test
58
- bun test v1.2.16-canary.20250611T140555
58
+ bun test v1.2.16
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.16-canary.20250611T140555",
2
+ "version": "1.2.16",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",
package/redis.d.ts CHANGED
@@ -50,6 +50,10 @@ declare module "bun" {
50
50
  enableAutoPipelining?: boolean;
51
51
  }
52
52
 
53
+ export namespace RedisClient {
54
+ type KeyLike = string | ArrayBufferView | Blob;
55
+ }
56
+
53
57
  export class RedisClient {
54
58
  /**
55
59
  * Creates a new Redis client
@@ -112,14 +116,14 @@ declare module "bun" {
112
116
  * @param key The key to get
113
117
  * @returns Promise that resolves with the key's value as a string, or null if the key doesn't exist
114
118
  */
115
- get(key: string | ArrayBufferView | Blob): Promise<string | null>;
119
+ get(key: RedisClient.KeyLike): Promise<string | null>;
116
120
 
117
121
  /**
118
122
  * Get the value of a key as a Uint8Array
119
123
  * @param key The key to get
120
124
  * @returns Promise that resolves with the key's value as a Uint8Array, or null if the key doesn't exist
121
125
  */
122
- getBuffer(key: string | ArrayBufferView | Blob): Promise<Uint8Array<ArrayBuffer> | null>;
126
+ getBuffer(key: RedisClient.KeyLike): Promise<Uint8Array<ArrayBuffer> | null>;
123
127
 
124
128
  /**
125
129
  * Set key to hold the string value
@@ -127,7 +131,7 @@ declare module "bun" {
127
131
  * @param value The value to set
128
132
  * @returns Promise that resolves with "OK" on success
129
133
  */
130
- set(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<"OK">;
134
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<"OK">;
131
135
 
132
136
  /**
133
137
  * Set key to hold the string value with expiration
@@ -136,12 +140,7 @@ declare module "bun" {
136
140
  * @param ex Set the specified expire time, in seconds
137
141
  * @returns Promise that resolves with "OK" on success
138
142
  */
139
- set(
140
- key: string | ArrayBufferView | Blob,
141
- value: string | ArrayBufferView | Blob,
142
- ex: "EX",
143
- seconds: number,
144
- ): Promise<"OK">;
143
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, ex: "EX", seconds: number): Promise<"OK">;
145
144
 
146
145
  /**
147
146
  * Set key to hold the string value with expiration
@@ -150,12 +149,7 @@ declare module "bun" {
150
149
  * @param px Set the specified expire time, in milliseconds
151
150
  * @returns Promise that resolves with "OK" on success
152
151
  */
153
- set(
154
- key: string | ArrayBufferView | Blob,
155
- value: string | ArrayBufferView | Blob,
156
- px: "PX",
157
- milliseconds: number,
158
- ): Promise<"OK">;
152
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, px: "PX", milliseconds: number): Promise<"OK">;
159
153
 
160
154
  /**
161
155
  * Set key to hold the string value with expiration at a specific Unix timestamp
@@ -164,12 +158,7 @@ declare module "bun" {
164
158
  * @param exat Set the specified Unix time at which the key will expire, in seconds
165
159
  * @returns Promise that resolves with "OK" on success
166
160
  */
167
- set(
168
- key: string | ArrayBufferView | Blob,
169
- value: string | ArrayBufferView | Blob,
170
- exat: "EXAT",
171
- timestampSeconds: number,
172
- ): Promise<"OK">;
161
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, exat: "EXAT", timestampSeconds: number): Promise<"OK">;
173
162
 
174
163
  /**
175
164
  * Set key to hold the string value with expiration at a specific Unix timestamp
@@ -179,8 +168,8 @@ declare module "bun" {
179
168
  * @returns Promise that resolves with "OK" on success
180
169
  */
181
170
  set(
182
- key: string | ArrayBufferView | Blob,
183
- value: string | ArrayBufferView | Blob,
171
+ key: RedisClient.KeyLike,
172
+ value: RedisClient.KeyLike,
184
173
  pxat: "PXAT",
185
174
  timestampMilliseconds: number,
186
175
  ): Promise<"OK">;
@@ -192,7 +181,7 @@ declare module "bun" {
192
181
  * @param nx Only set the key if it does not already exist
193
182
  * @returns Promise that resolves with "OK" on success, or null if the key already exists
194
183
  */
195
- set(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob, nx: "NX"): Promise<"OK" | null>;
184
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, nx: "NX"): Promise<"OK" | null>;
196
185
 
197
186
  /**
198
187
  * Set key to hold the string value only if key already exists
@@ -201,7 +190,7 @@ declare module "bun" {
201
190
  * @param xx Only set the key if it already exists
202
191
  * @returns Promise that resolves with "OK" on success, or null if the key does not exist
203
192
  */
204
- set(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob, xx: "XX"): Promise<"OK" | null>;
193
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, xx: "XX"): Promise<"OK" | null>;
205
194
 
206
195
  /**
207
196
  * Set key to hold the string value and return the old value
@@ -210,11 +199,7 @@ declare module "bun" {
210
199
  * @param get Return the old string stored at key, or null if key did not exist
211
200
  * @returns Promise that resolves with the old value, or null if key did not exist
212
201
  */
213
- set(
214
- key: string | ArrayBufferView | Blob,
215
- value: string | ArrayBufferView | Blob,
216
- get: "GET",
217
- ): Promise<string | null>;
202
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, get: "GET"): Promise<string | null>;
218
203
 
219
204
  /**
220
205
  * Set key to hold the string value and retain the time to live
@@ -223,11 +208,7 @@ declare module "bun" {
223
208
  * @param keepttl Retain the time to live associated with the key
224
209
  * @returns Promise that resolves with "OK" on success
225
210
  */
226
- set(
227
- key: string | ArrayBufferView | Blob,
228
- value: string | ArrayBufferView | Blob,
229
- keepttl: "KEEPTTL",
230
- ): Promise<"OK">;
211
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, keepttl: "KEEPTTL"): Promise<"OK">;
231
212
 
232
213
  /**
233
214
  * Set key to hold the string value with various options
@@ -236,39 +217,36 @@ declare module "bun" {
236
217
  * @param options Array of options (EX, PX, EXAT, PXAT, NX, XX, KEEPTTL, GET)
237
218
  * @returns Promise that resolves with "OK" on success, null if NX/XX condition not met, or the old value if GET is specified
238
219
  */
239
- set(
240
- key: string | ArrayBufferView | Blob,
241
- value: string | ArrayBufferView | Blob,
242
- ...options: string[]
243
- ): Promise<"OK" | string | null>;
220
+ set(key: RedisClient.KeyLike, value: RedisClient.KeyLike, ...options: string[]): Promise<"OK" | string | null>;
244
221
 
245
222
  /**
246
223
  * Delete a key
247
224
  * @param key The key to delete
225
+ * @param keys Additional keys to delete
248
226
  * @returns Promise that resolves with the number of keys removed
249
227
  */
250
- del(key: string | ArrayBufferView | Blob): Promise<number>;
228
+ del(key: RedisClient.KeyLike, ...keys: RedisClient.KeyLike[]): Promise<number>;
251
229
 
252
230
  /**
253
231
  * Increment the integer value of a key by one
254
232
  * @param key The key to increment
255
233
  * @returns Promise that resolves with the new value
256
234
  */
257
- incr(key: string | ArrayBufferView | Blob): Promise<number>;
235
+ incr(key: RedisClient.KeyLike): Promise<number>;
258
236
 
259
237
  /**
260
238
  * Decrement the integer value of a key by one
261
239
  * @param key The key to decrement
262
240
  * @returns Promise that resolves with the new value
263
241
  */
264
- decr(key: string | ArrayBufferView | Blob): Promise<number>;
242
+ decr(key: RedisClient.KeyLike): Promise<number>;
265
243
 
266
244
  /**
267
245
  * Determine if a key exists
268
246
  * @param key The key to check
269
247
  * @returns Promise that resolves with true if the key exists, false otherwise
270
248
  */
271
- exists(key: string | ArrayBufferView | Blob): Promise<boolean>;
249
+ exists(key: RedisClient.KeyLike): Promise<boolean>;
272
250
 
273
251
  /**
274
252
  * Set a key's time to live in seconds
@@ -276,14 +254,14 @@ declare module "bun" {
276
254
  * @param seconds The number of seconds until expiration
277
255
  * @returns Promise that resolves with 1 if the timeout was set, 0 if not
278
256
  */
279
- expire(key: string | ArrayBufferView | Blob, seconds: number): Promise<number>;
257
+ expire(key: RedisClient.KeyLike, seconds: number): Promise<number>;
280
258
 
281
259
  /**
282
260
  * Get the time to live for a key in seconds
283
261
  * @param key The key to get the TTL for
284
262
  * @returns Promise that resolves with the TTL, -1 if no expiry, or -2 if key doesn't exist
285
263
  */
286
- ttl(key: string | ArrayBufferView | Blob): Promise<number>;
264
+ ttl(key: RedisClient.KeyLike): Promise<number>;
287
265
 
288
266
  /**
289
267
  * Set multiple hash fields to multiple values
@@ -291,7 +269,7 @@ declare module "bun" {
291
269
  * @param fieldValues An array of alternating field names and values
292
270
  * @returns Promise that resolves with "OK" on success
293
271
  */
294
- hmset(key: string | ArrayBufferView | Blob, fieldValues: string[]): Promise<string>;
272
+ hmset(key: RedisClient.KeyLike, fieldValues: string[]): Promise<string>;
295
273
 
296
274
  /**
297
275
  * Get the values of all the given hash fields
@@ -299,7 +277,7 @@ declare module "bun" {
299
277
  * @param fields The fields to get
300
278
  * @returns Promise that resolves with an array of values
301
279
  */
302
- hmget(key: string | ArrayBufferView | Blob, fields: string[]): Promise<Array<string | null>>;
280
+ hmget(key: RedisClient.KeyLike, fields: string[]): Promise<Array<string | null>>;
303
281
 
304
282
  /**
305
283
  * Check if a value is a member of a set
@@ -307,7 +285,7 @@ declare module "bun" {
307
285
  * @param member The member to check
308
286
  * @returns Promise that resolves with true if the member exists, false otherwise
309
287
  */
310
- sismember(key: string | ArrayBufferView | Blob, member: string): Promise<boolean>;
288
+ sismember(key: RedisClient.KeyLike, member: string): Promise<boolean>;
311
289
 
312
290
  /**
313
291
  * Add a member to a set
@@ -315,7 +293,7 @@ declare module "bun" {
315
293
  * @param member The member to add
316
294
  * @returns Promise that resolves with 1 if the member was added, 0 if it already existed
317
295
  */
318
- sadd(key: string | ArrayBufferView | Blob, member: string): Promise<number>;
296
+ sadd(key: RedisClient.KeyLike, member: string): Promise<number>;
319
297
 
320
298
  /**
321
299
  * Remove a member from a set
@@ -323,28 +301,28 @@ declare module "bun" {
323
301
  * @param member The member to remove
324
302
  * @returns Promise that resolves with 1 if the member was removed, 0 if it didn't exist
325
303
  */
326
- srem(key: string | ArrayBufferView | Blob, member: string): Promise<number>;
304
+ srem(key: RedisClient.KeyLike, member: string): Promise<number>;
327
305
 
328
306
  /**
329
307
  * Get all the members in a set
330
308
  * @param key The set key
331
309
  * @returns Promise that resolves with an array of all members
332
310
  */
333
- smembers(key: string | ArrayBufferView | Blob): Promise<string[]>;
311
+ smembers(key: RedisClient.KeyLike): Promise<string[]>;
334
312
 
335
313
  /**
336
314
  * Get a random member from a set
337
315
  * @param key The set key
338
316
  * @returns Promise that resolves with a random member, or null if the set is empty
339
317
  */
340
- srandmember(key: string | ArrayBufferView | Blob): Promise<string | null>;
318
+ srandmember(key: RedisClient.KeyLike): Promise<string | null>;
341
319
 
342
320
  /**
343
321
  * Remove and return a random member from a set
344
322
  * @param key The set key
345
323
  * @returns Promise that resolves with the removed member, or null if the set is empty
346
324
  */
347
- spop(key: string | ArrayBufferView | Blob): Promise<string | null>;
325
+ spop(key: RedisClient.KeyLike): Promise<string | null>;
348
326
 
349
327
  /**
350
328
  * Increment the integer value of a hash field by the given number
@@ -353,7 +331,7 @@ declare module "bun" {
353
331
  * @param increment The amount to increment by
354
332
  * @returns Promise that resolves with the new value
355
333
  */
356
- hincrby(key: string | ArrayBufferView | Blob, field: string, increment: string | number): Promise<number>;
334
+ hincrby(key: RedisClient.KeyLike, field: string, increment: string | number): Promise<number>;
357
335
 
358
336
  /**
359
337
  * Increment the float value of a hash field by the given amount
@@ -362,35 +340,35 @@ declare module "bun" {
362
340
  * @param increment The amount to increment by
363
341
  * @returns Promise that resolves with the new value as a string
364
342
  */
365
- hincrbyfloat(key: string | ArrayBufferView | Blob, field: string, increment: string | number): Promise<string>;
343
+ hincrbyfloat(key: RedisClient.KeyLike, field: string, increment: string | number): Promise<string>;
366
344
 
367
345
  /**
368
346
  * Get all the fields and values in a hash
369
347
  * @param key The hash key
370
348
  * @returns Promise that resolves with an object containing all fields and values
371
349
  */
372
- hgetall(key: string | ArrayBufferView | Blob): Promise<Record<string, string> | null>;
350
+ hgetall(key: RedisClient.KeyLike): Promise<Record<string, string> | null>;
373
351
 
374
352
  /**
375
353
  * Get all field names in a hash
376
354
  * @param key The hash key
377
355
  * @returns Promise that resolves with an array of field names
378
356
  */
379
- hkeys(key: string | ArrayBufferView | Blob): Promise<string[]>;
357
+ hkeys(key: RedisClient.KeyLike): Promise<string[]>;
380
358
 
381
359
  /**
382
360
  * Get the number of fields in a hash
383
361
  * @param key The hash key
384
362
  * @returns Promise that resolves with the number of fields
385
363
  */
386
- hlen(key: string | ArrayBufferView | Blob): Promise<number>;
364
+ hlen(key: RedisClient.KeyLike): Promise<number>;
387
365
 
388
366
  /**
389
367
  * Get all values in a hash
390
368
  * @param key The hash key
391
369
  * @returns Promise that resolves with an array of values
392
370
  */
393
- hvals(key: string | ArrayBufferView | Blob): Promise<string[]>;
371
+ hvals(key: RedisClient.KeyLike): Promise<string[]>;
394
372
 
395
373
  /**
396
374
  * Find all keys matching the given pattern
@@ -404,84 +382,84 @@ declare module "bun" {
404
382
  * @param key The list key
405
383
  * @returns Promise that resolves with the length of the list
406
384
  */
407
- llen(key: string | ArrayBufferView | Blob): Promise<number>;
385
+ llen(key: RedisClient.KeyLike): Promise<number>;
408
386
 
409
387
  /**
410
388
  * Remove and get the first element in a list
411
389
  * @param key The list key
412
390
  * @returns Promise that resolves with the first element, or null if the list is empty
413
391
  */
414
- lpop(key: string | ArrayBufferView | Blob): Promise<string | null>;
392
+ lpop(key: RedisClient.KeyLike): Promise<string | null>;
415
393
 
416
394
  /**
417
395
  * Remove the expiration from a key
418
396
  * @param key The key to persist
419
397
  * @returns Promise that resolves with 1 if the timeout was removed, 0 if the key doesn't exist or has no timeout
420
398
  */
421
- persist(key: string | ArrayBufferView | Blob): Promise<number>;
399
+ persist(key: RedisClient.KeyLike): Promise<number>;
422
400
 
423
401
  /**
424
402
  * Get the expiration time of a key as a UNIX timestamp in milliseconds
425
403
  * @param key The key to check
426
404
  * @returns Promise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
427
405
  */
428
- pexpiretime(key: string | ArrayBufferView | Blob): Promise<number>;
406
+ pexpiretime(key: RedisClient.KeyLike): Promise<number>;
429
407
 
430
408
  /**
431
409
  * Get the time to live for a key in milliseconds
432
410
  * @param key The key to check
433
411
  * @returns Promise that resolves with the TTL in milliseconds, or -1 if the key has no expiration, or -2 if the key doesn't exist
434
412
  */
435
- pttl(key: string | ArrayBufferView | Blob): Promise<number>;
413
+ pttl(key: RedisClient.KeyLike): Promise<number>;
436
414
 
437
415
  /**
438
416
  * Remove and get the last element in a list
439
417
  * @param key The list key
440
418
  * @returns Promise that resolves with the last element, or null if the list is empty
441
419
  */
442
- rpop(key: string | ArrayBufferView | Blob): Promise<string | null>;
420
+ rpop(key: RedisClient.KeyLike): Promise<string | null>;
443
421
 
444
422
  /**
445
423
  * Get the number of members in a set
446
424
  * @param key The set key
447
425
  * @returns Promise that resolves with the cardinality (number of elements) of the set
448
426
  */
449
- scard(key: string | ArrayBufferView | Blob): Promise<number>;
427
+ scard(key: RedisClient.KeyLike): Promise<number>;
450
428
 
451
429
  /**
452
430
  * Get the length of the value stored in a key
453
431
  * @param key The key to check
454
432
  * @returns Promise that resolves with the length of the string value, or 0 if the key doesn't exist
455
433
  */
456
- strlen(key: string | ArrayBufferView | Blob): Promise<number>;
434
+ strlen(key: RedisClient.KeyLike): Promise<number>;
457
435
 
458
436
  /**
459
437
  * Get the number of members in a sorted set
460
438
  * @param key The sorted set key
461
439
  * @returns Promise that resolves with the cardinality (number of elements) of the sorted set
462
440
  */
463
- zcard(key: string | ArrayBufferView | Blob): Promise<number>;
441
+ zcard(key: RedisClient.KeyLike): Promise<number>;
464
442
 
465
443
  /**
466
444
  * Remove and return members with the highest scores in a sorted set
467
445
  * @param key The sorted set key
468
446
  * @returns Promise that resolves with the removed member and its score, or null if the set is empty
469
447
  */
470
- zpopmax(key: string | ArrayBufferView | Blob): Promise<string | null>;
448
+ zpopmax(key: RedisClient.KeyLike): Promise<string | null>;
471
449
 
472
450
  /**
473
451
  * Remove and return members with the lowest scores in a sorted set
474
452
  * @param key The sorted set key
475
453
  * @returns Promise that resolves with the removed member and its score, or null if the set is empty
476
454
  */
477
- zpopmin(key: string | ArrayBufferView | Blob): Promise<string | null>;
455
+ zpopmin(key: RedisClient.KeyLike): Promise<string | null>;
478
456
 
479
457
  /**
480
458
  * Get one or multiple random members from a sorted set
481
459
  * @param key The sorted set key
482
460
  * @returns Promise that resolves with a random member, or null if the set is empty
483
461
  */
484
- zrandmember(key: string | ArrayBufferView | Blob): Promise<string | null>;
462
+ zrandmember(key: RedisClient.KeyLike): Promise<string | null>;
485
463
 
486
464
  /**
487
465
  * Append a value to a key
@@ -489,7 +467,7 @@ declare module "bun" {
489
467
  * @param value The value to append
490
468
  * @returns Promise that resolves with the length of the string after the append operation
491
469
  */
492
- append(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
470
+ append(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
493
471
 
494
472
  /**
495
473
  * Set the value of a key and return its old value
@@ -497,7 +475,7 @@ declare module "bun" {
497
475
  * @param value The value to set
498
476
  * @returns Promise that resolves with the old value, or null if the key didn't exist
499
477
  */
500
- getset(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<string | null>;
478
+ getset(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<string | null>;
501
479
 
502
480
  /**
503
481
  * Prepend one or multiple values to a list
@@ -505,7 +483,7 @@ declare module "bun" {
505
483
  * @param value The value to prepend
506
484
  * @returns Promise that resolves with the length of the list after the push operation
507
485
  */
508
- lpush(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
486
+ lpush(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
509
487
 
510
488
  /**
511
489
  * Prepend a value to a list, only if the list exists
@@ -513,7 +491,7 @@ declare module "bun" {
513
491
  * @param value The value to prepend
514
492
  * @returns Promise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
515
493
  */
516
- lpushx(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
494
+ lpushx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
517
495
 
518
496
  /**
519
497
  * Add one or more members to a HyperLogLog
@@ -521,7 +499,7 @@ declare module "bun" {
521
499
  * @param element The element to add
522
500
  * @returns Promise that resolves with 1 if the HyperLogLog was altered, 0 otherwise
523
501
  */
524
- pfadd(key: string | ArrayBufferView | Blob, element: string): Promise<number>;
502
+ pfadd(key: RedisClient.KeyLike, element: string): Promise<number>;
525
503
 
526
504
  /**
527
505
  * Append one or multiple values to a list
@@ -529,7 +507,7 @@ declare module "bun" {
529
507
  * @param value The value to append
530
508
  * @returns Promise that resolves with the length of the list after the push operation
531
509
  */
532
- rpush(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
510
+ rpush(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
533
511
 
534
512
  /**
535
513
  * Append a value to a list, only if the list exists
@@ -537,7 +515,7 @@ declare module "bun" {
537
515
  * @param value The value to append
538
516
  * @returns Promise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
539
517
  */
540
- rpushx(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
518
+ rpushx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
541
519
 
542
520
  /**
543
521
  * Set the value of a key, only if the key does not exist
@@ -545,7 +523,7 @@ declare module "bun" {
545
523
  * @param value The value to set
546
524
  * @returns Promise that resolves with 1 if the key was set, 0 if the key was not set
547
525
  */
548
- setnx(key: string | ArrayBufferView | Blob, value: string | ArrayBufferView | Blob): Promise<number>;
526
+ setnx(key: RedisClient.KeyLike, value: RedisClient.KeyLike): Promise<number>;
549
527
 
550
528
  /**
551
529
  * Get the score associated with the given member in a sorted set
@@ -553,49 +531,49 @@ declare module "bun" {
553
531
  * @param member The member to get the score for
554
532
  * @returns Promise that resolves with the score of the member as a string, or null if the member or key doesn't exist
555
533
  */
556
- zscore(key: string | ArrayBufferView | Blob, member: string): Promise<string | null>;
534
+ zscore(key: RedisClient.KeyLike, member: string): Promise<string | null>;
557
535
 
558
536
  /**
559
537
  * Get the values of all specified keys
560
538
  * @param keys The keys to get
561
539
  * @returns Promise that resolves with an array of values, with null for keys that don't exist
562
540
  */
563
- mget(...keys: (string | ArrayBufferView | Blob)[]): Promise<(string | null)[]>;
541
+ mget(...keys: RedisClient.KeyLike[]): Promise<(string | null)[]>;
564
542
 
565
543
  /**
566
544
  * Count the number of set bits (population counting) in a string
567
545
  * @param key The key to count bits in
568
546
  * @returns Promise that resolves with the number of bits set to 1
569
547
  */
570
- bitcount(key: string | ArrayBufferView | Blob): Promise<number>;
548
+ bitcount(key: RedisClient.KeyLike): Promise<number>;
571
549
 
572
550
  /**
573
551
  * Return a serialized version of the value stored at the specified key
574
552
  * @param key The key to dump
575
553
  * @returns Promise that resolves with the serialized value, or null if the key doesn't exist
576
554
  */
577
- dump(key: string | ArrayBufferView | Blob): Promise<string | null>;
555
+ dump(key: RedisClient.KeyLike): Promise<string | null>;
578
556
 
579
557
  /**
580
558
  * Get the expiration time of a key as a UNIX timestamp in seconds
581
559
  * @param key The key to check
582
560
  * @returns Promise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
583
561
  */
584
- expiretime(key: string | ArrayBufferView | Blob): Promise<number>;
562
+ expiretime(key: RedisClient.KeyLike): Promise<number>;
585
563
 
586
564
  /**
587
565
  * Get the value of a key and delete the key
588
566
  * @param key The key to get and delete
589
567
  * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
590
568
  */
591
- getdel(key: string | ArrayBufferView | Blob): Promise<string | null>;
569
+ getdel(key: RedisClient.KeyLike): Promise<string | null>;
592
570
 
593
571
  /**
594
572
  * Get the value of a key and optionally set its expiration
595
573
  * @param key The key to get
596
574
  * @returns Promise that resolves with the value of the key, or null if the key doesn't exist
597
575
  */
598
- getex(key: string | ArrayBufferView | Blob): Promise<string | null>;
576
+ getex(key: RedisClient.KeyLike): Promise<string | null>;
599
577
 
600
578
  /**
601
579
  * Ping the server
@@ -608,7 +586,7 @@ declare module "bun" {
608
586
  * @param message The message to send to the server
609
587
  * @returns Promise that resolves with the message if the server is reachable, or throws an error if the server is not reachable
610
588
  */
611
- ping(message: string | ArrayBufferView | Blob): Promise<string>;
589
+ ping(message: RedisClient.KeyLike): Promise<string>;
612
590
  }
613
591
 
614
592
  /**