You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**`(feat):`** Add support for the `Uploadable.FromPath` and `Uploadable.WithMetadata` types to upload files with metadata to multipart-form endpoints.
3
+
4
+
Users can configure metadata when uploading a file to a multipart-form upload endpoint using the `Uploadable.WithMetadata` type:
5
+
```typescript
6
+
import { createReadStream } from"fs";
7
+
8
+
awaitclient.upload({
9
+
file: {
10
+
data: createReadStream("path/to/file"),
11
+
filename: "my-file",
12
+
contentType: "audio/mpeg",
13
+
},
14
+
otherField: "other value",
15
+
});
16
+
```
17
+
The `filename`, `contentType`, and `contentLength` properties are optional.
18
+
19
+
Alternatively, users can use the `Uploadable.FromPath` type to upload directly from a file path:
20
+
```typescript
21
+
awaitclient.upload({
22
+
file: {
23
+
path: "path/to/file",
24
+
filename: "my-file",
25
+
contentType: "audio/mpeg",
26
+
},
27
+
otherField: "other value",
28
+
});
29
+
```
30
+
31
+
The metadata is used to set the `Content-Type` and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
0 commit comments