bun-types 1.2.10-canary.20250414T140624 → 1.2.10-canary.20250415T140641
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 +369 -424
- package/devserver.d.ts +0 -2
- package/docs/api/fetch.md +1 -1
- package/docs/api/redis.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 +83 -34
- package/index.d.ts +2 -0
- package/package.json +2 -3
- package/s3.d.ts +349 -12
- package/shell.d.ts +355 -0
- package/sqlite.d.ts +62 -66
- package/test.d.ts +6 -1
package/s3.d.ts
CHANGED
|
@@ -9,17 +9,30 @@ declare module "bun" {
|
|
|
9
9
|
* Write a chunk of data to the file.
|
|
10
10
|
*
|
|
11
11
|
* If the file descriptor is not writable yet, the data is buffered.
|
|
12
|
+
*
|
|
13
|
+
* @param chunk The data to write
|
|
14
|
+
* @returns Number of bytes written
|
|
12
15
|
*/
|
|
13
16
|
write(chunk: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer): number;
|
|
14
17
|
/**
|
|
15
18
|
* Flush the internal buffer, committing the data to disk or the pipe.
|
|
19
|
+
*
|
|
20
|
+
* @returns Number of bytes flushed or a Promise resolving to the number of bytes
|
|
16
21
|
*/
|
|
17
22
|
flush(): number | Promise<number>;
|
|
18
23
|
/**
|
|
19
24
|
* Close the file descriptor. This also flushes the internal buffer.
|
|
25
|
+
*
|
|
26
|
+
* @param error Optional error to associate with the close operation
|
|
27
|
+
* @returns Number of bytes written or a Promise resolving to the number of bytes
|
|
20
28
|
*/
|
|
21
29
|
end(error?: Error): number | Promise<number>;
|
|
22
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Start the file sink with provided options.
|
|
33
|
+
*
|
|
34
|
+
* @param options Configuration options for the file sink
|
|
35
|
+
*/
|
|
23
36
|
start(options?: {
|
|
24
37
|
/**
|
|
25
38
|
* Preallocate an internal buffer of this size
|
|
@@ -63,19 +76,29 @@ declare module "bun" {
|
|
|
63
76
|
* Write a chunk of data to the network.
|
|
64
77
|
*
|
|
65
78
|
* If the network is not writable yet, the data is buffered.
|
|
79
|
+
*
|
|
80
|
+
* @param chunk The data to write
|
|
81
|
+
* @returns Number of bytes written
|
|
66
82
|
*/
|
|
67
83
|
write(chunk: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer): number;
|
|
68
84
|
/**
|
|
69
85
|
* Flush the internal buffer, committing the data to the network.
|
|
86
|
+
*
|
|
87
|
+
* @returns Number of bytes flushed or a Promise resolving to the number of bytes
|
|
70
88
|
*/
|
|
71
89
|
flush(): number | Promise<number>;
|
|
72
90
|
/**
|
|
73
91
|
* Finish the upload. This also flushes the internal buffer.
|
|
92
|
+
*
|
|
93
|
+
* @param error Optional error to associate with the end operation
|
|
94
|
+
* @returns Number of bytes written or a Promise resolving to the number of bytes
|
|
74
95
|
*/
|
|
75
96
|
end(error?: Error): number | Promise<number>;
|
|
76
97
|
|
|
77
98
|
/**
|
|
78
99
|
* Get the stat of the file.
|
|
100
|
+
*
|
|
101
|
+
* @returns Promise resolving to the file stats
|
|
79
102
|
*/
|
|
80
103
|
stat(): Promise<import("node:fs").Stats>;
|
|
81
104
|
}
|
|
@@ -649,7 +672,7 @@ declare module "bun" {
|
|
|
649
672
|
contents?: {
|
|
650
673
|
/** The algorithm that was used to create a checksum of the object. */
|
|
651
674
|
checksumAlgorithm?: "CRC32" | "CRC32C" | "SHA1" | "SHA256" | "CRC64NVME";
|
|
652
|
-
/** The checksum type that is used to calculate the object
|
|
675
|
+
/** The checksum type that is used to calculate the object's checksum value. */
|
|
653
676
|
checksumType?: "COMPOSITE" | "FULL_OBJECT";
|
|
654
677
|
/**
|
|
655
678
|
* The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:
|
|
@@ -748,6 +771,7 @@ declare module "bun" {
|
|
|
748
771
|
*
|
|
749
772
|
* @param options The default options to use for the S3 client. Can be
|
|
750
773
|
* overriden by passing options to the methods.
|
|
774
|
+
* @returns A new S3Client instance
|
|
751
775
|
*
|
|
752
776
|
* ## Keep S3 credentials in a single instance
|
|
753
777
|
*
|
|
@@ -779,20 +803,49 @@ declare module "bun" {
|
|
|
779
803
|
/**
|
|
780
804
|
* Creates an S3File instance for the given path.
|
|
781
805
|
*
|
|
806
|
+
* @param path The path to the file in the bucket
|
|
807
|
+
* @param options Additional S3 options to override defaults
|
|
808
|
+
* @returns An S3File instance
|
|
809
|
+
*
|
|
782
810
|
* @example
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
*
|
|
811
|
+
* const file = bucket.file("image.jpg");
|
|
812
|
+
* await file.write(imageData);
|
|
813
|
+
*
|
|
814
|
+
* const configFile = bucket.file("config.json", {
|
|
815
|
+
* type: "application/json",
|
|
816
|
+
* acl: "private"
|
|
817
|
+
* });
|
|
789
818
|
*/
|
|
790
819
|
file(path: string, options?: S3Options): S3File;
|
|
791
820
|
|
|
821
|
+
/**
|
|
822
|
+
* Creates an S3File instance for the given path.
|
|
823
|
+
*
|
|
824
|
+
* @param path The path to the file in the bucket
|
|
825
|
+
* @param options S3 credentials and configuration options
|
|
826
|
+
* @returns An S3File instance
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* const file = S3Client.file("image.jpg", credentials);
|
|
830
|
+
* await file.write(imageData);
|
|
831
|
+
*
|
|
832
|
+
* const configFile = S3Client.file("config.json", {
|
|
833
|
+
* ...credentials,
|
|
834
|
+
* type: "application/json",
|
|
835
|
+
* acl: "private"
|
|
836
|
+
* });
|
|
837
|
+
*/
|
|
838
|
+
static file(path: string, options?: S3Options): S3File;
|
|
839
|
+
|
|
792
840
|
/**
|
|
793
841
|
* Writes data directly to a path in the bucket.
|
|
794
842
|
* Supports strings, buffers, streams, and web API types.
|
|
795
843
|
*
|
|
844
|
+
* @param path The path to the file in the bucket
|
|
845
|
+
* @param data The data to write to the file
|
|
846
|
+
* @param options Additional S3 options to override defaults
|
|
847
|
+
* @returns The number of bytes written
|
|
848
|
+
*
|
|
796
849
|
* @example
|
|
797
850
|
* // Write string
|
|
798
851
|
* await bucket.write("hello.txt", "Hello World");
|
|
@@ -830,10 +883,64 @@ declare module "bun" {
|
|
|
830
883
|
options?: S3Options,
|
|
831
884
|
): Promise<number>;
|
|
832
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Writes data directly to a path in the bucket.
|
|
888
|
+
* Supports strings, buffers, streams, and web API types.
|
|
889
|
+
*
|
|
890
|
+
* @param path The path to the file in the bucket
|
|
891
|
+
* @param data The data to write to the file
|
|
892
|
+
* @param options S3 credentials and configuration options
|
|
893
|
+
* @returns The number of bytes written
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* // Write string
|
|
897
|
+
* await S3Client.write("hello.txt", "Hello World", credentials);
|
|
898
|
+
*
|
|
899
|
+
* // Write JSON with type
|
|
900
|
+
* await S3Client.write(
|
|
901
|
+
* "data.json",
|
|
902
|
+
* JSON.stringify({hello: "world"}),
|
|
903
|
+
* {
|
|
904
|
+
* ...credentials,
|
|
905
|
+
* type: "application/json"
|
|
906
|
+
* }
|
|
907
|
+
* );
|
|
908
|
+
*
|
|
909
|
+
* // Write from fetch
|
|
910
|
+
* const res = await fetch("https://example.com/data");
|
|
911
|
+
* await S3Client.write("data.bin", res, credentials);
|
|
912
|
+
*
|
|
913
|
+
* // Write with ACL
|
|
914
|
+
* await S3Client.write("public.html", html, {
|
|
915
|
+
* ...credentials,
|
|
916
|
+
* acl: "public-read",
|
|
917
|
+
* type: "text/html"
|
|
918
|
+
* });
|
|
919
|
+
*/
|
|
920
|
+
static write(
|
|
921
|
+
path: string,
|
|
922
|
+
data:
|
|
923
|
+
| string
|
|
924
|
+
| ArrayBufferView
|
|
925
|
+
| ArrayBuffer
|
|
926
|
+
| SharedArrayBuffer
|
|
927
|
+
| Request
|
|
928
|
+
| Response
|
|
929
|
+
| BunFile
|
|
930
|
+
| S3File
|
|
931
|
+
| Blob
|
|
932
|
+
| File,
|
|
933
|
+
options?: S3Options,
|
|
934
|
+
): Promise<number>;
|
|
935
|
+
|
|
833
936
|
/**
|
|
834
937
|
* Generate a presigned URL for temporary access to a file.
|
|
835
938
|
* Useful for generating upload/download URLs without exposing credentials.
|
|
836
939
|
*
|
|
940
|
+
* @param path The path to the file in the bucket
|
|
941
|
+
* @param options Options for generating the presigned URL
|
|
942
|
+
* @returns A presigned URL string
|
|
943
|
+
*
|
|
837
944
|
* @example
|
|
838
945
|
* // Download URL
|
|
839
946
|
* const downloadUrl = bucket.presign("file.pdf", {
|
|
@@ -856,9 +963,46 @@ declare module "bun" {
|
|
|
856
963
|
*/
|
|
857
964
|
presign(path: string, options?: S3FilePresignOptions): string;
|
|
858
965
|
|
|
966
|
+
/**
|
|
967
|
+
* Generate a presigned URL for temporary access to a file.
|
|
968
|
+
* Useful for generating upload/download URLs without exposing credentials.
|
|
969
|
+
*
|
|
970
|
+
* @param path The path to the file in the bucket
|
|
971
|
+
* @param options S3 credentials and presigned URL configuration
|
|
972
|
+
* @returns A presigned URL string
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* // Download URL
|
|
976
|
+
* const downloadUrl = S3Client.presign("file.pdf", {
|
|
977
|
+
* ...credentials,
|
|
978
|
+
* expiresIn: 3600 // 1 hour
|
|
979
|
+
* });
|
|
980
|
+
*
|
|
981
|
+
* // Upload URL
|
|
982
|
+
* const uploadUrl = S3Client.presign("uploads/image.jpg", {
|
|
983
|
+
* ...credentials,
|
|
984
|
+
* method: "PUT",
|
|
985
|
+
* expiresIn: 3600,
|
|
986
|
+
* type: "image/jpeg",
|
|
987
|
+
* acl: "public-read"
|
|
988
|
+
* });
|
|
989
|
+
*
|
|
990
|
+
* // Long-lived public URL
|
|
991
|
+
* const publicUrl = S3Client.presign("public/doc.pdf", {
|
|
992
|
+
* ...credentials,
|
|
993
|
+
* expiresIn: 7 * 24 * 60 * 60, // 7 days
|
|
994
|
+
* acl: "public-read"
|
|
995
|
+
* });
|
|
996
|
+
*/
|
|
997
|
+
static presign(path: string, options?: S3FilePresignOptions): string;
|
|
998
|
+
|
|
859
999
|
/**
|
|
860
1000
|
* Delete a file from the bucket.
|
|
861
1001
|
*
|
|
1002
|
+
* @param path The path to the file in the bucket
|
|
1003
|
+
* @param options Additional S3 options to override defaults
|
|
1004
|
+
* @returns A promise that resolves when deletion is complete
|
|
1005
|
+
*
|
|
862
1006
|
* @example
|
|
863
1007
|
* // Simple delete
|
|
864
1008
|
* await bucket.unlink("old-file.txt");
|
|
@@ -872,12 +1016,80 @@ declare module "bun" {
|
|
|
872
1016
|
* }
|
|
873
1017
|
*/
|
|
874
1018
|
unlink(path: string, options?: S3Options): Promise<void>;
|
|
875
|
-
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Delete a file from the bucket.
|
|
1022
|
+
*
|
|
1023
|
+
* @param path The path to the file in the bucket
|
|
1024
|
+
* @param options S3 credentials and configuration options
|
|
1025
|
+
* @returns A promise that resolves when deletion is complete
|
|
1026
|
+
*
|
|
1027
|
+
* @example
|
|
1028
|
+
* // Simple delete
|
|
1029
|
+
* await S3Client.unlink("old-file.txt", credentials);
|
|
1030
|
+
*
|
|
1031
|
+
* // With error handling
|
|
1032
|
+
* try {
|
|
1033
|
+
* await S3Client.unlink("file.dat", credentials);
|
|
1034
|
+
* console.log("File deleted");
|
|
1035
|
+
* } catch (err) {
|
|
1036
|
+
* console.error("Delete failed:", err);
|
|
1037
|
+
* }
|
|
1038
|
+
*/
|
|
1039
|
+
static unlink(path: string, options?: S3Options): Promise<void>;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Delete a file from the bucket.
|
|
1043
|
+
* Alias for {@link S3Client.unlink}.
|
|
1044
|
+
*
|
|
1045
|
+
* @param path The path to the file in the bucket
|
|
1046
|
+
* @param options Additional S3 options to override defaults
|
|
1047
|
+
* @returns A promise that resolves when deletion is complete
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* // Simple delete
|
|
1051
|
+
* await bucket.delete("old-file.txt");
|
|
1052
|
+
*
|
|
1053
|
+
* // With error handling
|
|
1054
|
+
* try {
|
|
1055
|
+
* await bucket.delete("file.dat");
|
|
1056
|
+
* console.log("File deleted");
|
|
1057
|
+
* } catch (err) {
|
|
1058
|
+
* console.error("Delete failed:", err);
|
|
1059
|
+
* }
|
|
1060
|
+
*/
|
|
1061
|
+
delete(path: string, options?: S3Options): Promise<void>;
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Delete a file from the bucket.
|
|
1065
|
+
* Alias for {@link S3Client.unlink}.
|
|
1066
|
+
*
|
|
1067
|
+
* @param path The path to the file in the bucket
|
|
1068
|
+
* @param options S3 credentials and configuration options
|
|
1069
|
+
* @returns A promise that resolves when deletion is complete
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* // Simple delete
|
|
1073
|
+
* await S3Client.delete("old-file.txt", credentials);
|
|
1074
|
+
*
|
|
1075
|
+
* // With error handling
|
|
1076
|
+
* try {
|
|
1077
|
+
* await S3Client.delete("file.dat", credentials);
|
|
1078
|
+
* console.log("File deleted");
|
|
1079
|
+
* } catch (err) {
|
|
1080
|
+
* console.error("Delete failed:", err);
|
|
1081
|
+
* }
|
|
1082
|
+
*/
|
|
1083
|
+
static delete(path: string, options?: S3Options): Promise<void>;
|
|
876
1084
|
|
|
877
1085
|
/**
|
|
878
1086
|
* Get the size of a file in bytes.
|
|
879
1087
|
* Uses HEAD request to efficiently get size.
|
|
880
1088
|
*
|
|
1089
|
+
* @param path The path to the file in the bucket
|
|
1090
|
+
* @param options Additional S3 options to override defaults
|
|
1091
|
+
* @returns A promise that resolves to the file size in bytes
|
|
1092
|
+
*
|
|
881
1093
|
* @example
|
|
882
1094
|
* // Get size
|
|
883
1095
|
* const bytes = await bucket.size("video.mp4");
|
|
@@ -890,10 +1102,34 @@ declare module "bun" {
|
|
|
890
1102
|
*/
|
|
891
1103
|
size(path: string, options?: S3Options): Promise<number>;
|
|
892
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* Get the size of a file in bytes.
|
|
1107
|
+
* Uses HEAD request to efficiently get size.
|
|
1108
|
+
*
|
|
1109
|
+
* @param path The path to the file in the bucket
|
|
1110
|
+
* @param options S3 credentials and configuration options
|
|
1111
|
+
* @returns A promise that resolves to the file size in bytes
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* // Get size
|
|
1115
|
+
* const bytes = await S3Client.size("video.mp4", credentials);
|
|
1116
|
+
* console.log(`Size: ${bytes} bytes`);
|
|
1117
|
+
*
|
|
1118
|
+
* // Check if file is large
|
|
1119
|
+
* if (await S3Client.size("data.zip", credentials) > 100 * 1024 * 1024) {
|
|
1120
|
+
* console.log("File is larger than 100MB");
|
|
1121
|
+
* }
|
|
1122
|
+
*/
|
|
1123
|
+
static size(path: string, options?: S3Options): Promise<number>;
|
|
1124
|
+
|
|
893
1125
|
/**
|
|
894
1126
|
* Check if a file exists in the bucket.
|
|
895
1127
|
* Uses HEAD request to check existence.
|
|
896
1128
|
*
|
|
1129
|
+
* @param path The path to the file in the bucket
|
|
1130
|
+
* @param options Additional S3 options to override defaults
|
|
1131
|
+
* @returns A promise that resolves to true if the file exists, false otherwise
|
|
1132
|
+
*
|
|
897
1133
|
* @example
|
|
898
1134
|
* // Check existence
|
|
899
1135
|
* if (await bucket.exists("config.json")) {
|
|
@@ -911,23 +1147,124 @@ declare module "bun" {
|
|
|
911
1147
|
* }
|
|
912
1148
|
*/
|
|
913
1149
|
exists(path: string, options?: S3Options): Promise<boolean>;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Check if a file exists in the bucket.
|
|
1153
|
+
* Uses HEAD request to check existence.
|
|
1154
|
+
*
|
|
1155
|
+
* @param path The path to the file in the bucket
|
|
1156
|
+
* @param options S3 credentials and configuration options
|
|
1157
|
+
* @returns A promise that resolves to true if the file exists, false otherwise
|
|
1158
|
+
*
|
|
1159
|
+
* @example
|
|
1160
|
+
* // Check existence
|
|
1161
|
+
* if (await S3Client.exists("config.json", credentials)) {
|
|
1162
|
+
* const file = bucket.file("config.json");
|
|
1163
|
+
* const config = await file.json();
|
|
1164
|
+
* }
|
|
1165
|
+
*
|
|
1166
|
+
* // With error handling
|
|
1167
|
+
* try {
|
|
1168
|
+
* if (!await S3Client.exists("required.txt", credentials)) {
|
|
1169
|
+
* throw new Error("Required file missing");
|
|
1170
|
+
* }
|
|
1171
|
+
* } catch (err) {
|
|
1172
|
+
* console.error("Check failed:", err);
|
|
1173
|
+
* }
|
|
1174
|
+
*/
|
|
1175
|
+
static exists(path: string, options?: S3Options): Promise<boolean>;
|
|
1176
|
+
|
|
914
1177
|
/**
|
|
915
1178
|
* Get the stat of a file in an S3-compatible storage service.
|
|
916
1179
|
*
|
|
917
|
-
* @param path The path to the file
|
|
918
|
-
* @param options
|
|
1180
|
+
* @param path The path to the file in the bucket
|
|
1181
|
+
* @param options Additional S3 options to override defaults
|
|
1182
|
+
* @returns A promise that resolves to the file stats
|
|
1183
|
+
*
|
|
1184
|
+
* @example
|
|
1185
|
+
* const stat = await bucket.stat("my-file.txt");
|
|
919
1186
|
*/
|
|
920
1187
|
stat(path: string, options?: S3Options): Promise<S3Stats>;
|
|
921
1188
|
|
|
922
|
-
/**
|
|
1189
|
+
/**
|
|
1190
|
+
* Get the stat of a file in an S3-compatible storage service.
|
|
1191
|
+
*
|
|
1192
|
+
* @param path The path to the file in the bucket
|
|
1193
|
+
* @param options S3 credentials and configuration options
|
|
1194
|
+
* @returns A promise that resolves to the file stats
|
|
923
1195
|
*
|
|
924
|
-
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* const stat = await S3Client.stat("my-file.txt", credentials);
|
|
1198
|
+
*/
|
|
1199
|
+
static stat(path: string, options?: S3Options): Promise<S3Stats>;
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Returns some or all (up to 1,000) of the objects in a bucket with each request.
|
|
1203
|
+
*
|
|
1204
|
+
* You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
|
|
1205
|
+
*
|
|
1206
|
+
* @param input Options for listing objects in the bucket
|
|
1207
|
+
* @param options Additional S3 options to override defaults
|
|
1208
|
+
* @returns A promise that resolves to the list response
|
|
1209
|
+
*
|
|
1210
|
+
* @example
|
|
1211
|
+
* // List (up to) 1000 objects in the bucket
|
|
1212
|
+
* const allObjects = await bucket.list();
|
|
1213
|
+
*
|
|
1214
|
+
* // List (up to) 500 objects under `uploads/` prefix, with owner field for each object
|
|
1215
|
+
* const uploads = await bucket.list({
|
|
1216
|
+
* prefix: 'uploads/',
|
|
1217
|
+
* maxKeys: 500,
|
|
1218
|
+
* fetchOwner: true,
|
|
1219
|
+
* });
|
|
1220
|
+
*
|
|
1221
|
+
* // Check if more results are available
|
|
1222
|
+
* if (uploads.isTruncated) {
|
|
1223
|
+
* // List next batch of objects under `uploads/` prefix
|
|
1224
|
+
* const moreUploads = await bucket.list({
|
|
1225
|
+
* prefix: 'uploads/',
|
|
1226
|
+
* maxKeys: 500,
|
|
1227
|
+
* startAfter: uploads.contents!.at(-1).key
|
|
1228
|
+
* fetchOwner: true,
|
|
1229
|
+
* });
|
|
1230
|
+
* }
|
|
925
1231
|
*/
|
|
926
1232
|
list(
|
|
927
1233
|
input?: S3ListObjectsOptions | null,
|
|
928
1234
|
options?: Pick<S3Options, "accessKeyId" | "secretAccessKey" | "sessionToken" | "region" | "bucket" | "endpoint">,
|
|
929
1235
|
): Promise<S3ListObjectsResponse>;
|
|
930
1236
|
|
|
1237
|
+
/**
|
|
1238
|
+
* Returns some or all (up to 1,000) of the objects in a bucket with each request.
|
|
1239
|
+
*
|
|
1240
|
+
* You can use the request parameters as selection criteria to return a subset of the objects in a bucket.
|
|
1241
|
+
*
|
|
1242
|
+
* @param input Options for listing objects in the bucket
|
|
1243
|
+
* @param options S3 credentials and configuration options
|
|
1244
|
+
* @returns A promise that resolves to the list response
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* // List (up to) 1000 objects in the bucket
|
|
1248
|
+
* const allObjects = await S3Client.list(null, credentials);
|
|
1249
|
+
*
|
|
1250
|
+
* // List (up to) 500 objects under `uploads/` prefix, with owner field for each object
|
|
1251
|
+
* const uploads = await S3Client.list({
|
|
1252
|
+
* prefix: 'uploads/',
|
|
1253
|
+
* maxKeys: 500,
|
|
1254
|
+
* fetchOwner: true,
|
|
1255
|
+
* }, credentials);
|
|
1256
|
+
*
|
|
1257
|
+
* // Check if more results are available
|
|
1258
|
+
* if (uploads.isTruncated) {
|
|
1259
|
+
* // List next batch of objects under `uploads/` prefix
|
|
1260
|
+
* const moreUploads = await S3Client.list({
|
|
1261
|
+
* prefix: 'uploads/',
|
|
1262
|
+
* maxKeys: 500,
|
|
1263
|
+
* startAfter: uploads.contents!.at(-1).key
|
|
1264
|
+
* fetchOwner: true,
|
|
1265
|
+
* }, credentials);
|
|
1266
|
+
* }
|
|
1267
|
+
*/
|
|
931
1268
|
static list(
|
|
932
1269
|
input?: S3ListObjectsOptions | null,
|
|
933
1270
|
options?: Pick<S3Options, "accessKeyId" | "secretAccessKey" | "sessionToken" | "region" | "bucket" | "endpoint">,
|