Skip to content

Commit c3f0348

Browse files
committed
Document new params argument to s3.putObject
1 parent 51426b1 commit c3f0348

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/data/markdown/docs/20 jslib/01 jslib/01 aws/S3Client/00 putObject(bucketName, objectKey, data).md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@ excerpt: 'S3Client.putObject uploads an object to a bucket'
88

99
### Parameters
1010

11-
| Parameter | Type | Description |
12-
| :--------- | :-------------------- | :------------------------------------------- |
13-
| bucketName | string | Name of the bucket to upload the object to. |
14-
| objectKey | string | Name of the uploaded object. |
15-
| data | string \| ArrayBuffer | Content of the object to upload. |
11+
| Parameter | Type | Description |
12+
| :------------ | :---------------------------------------------- | :------------------------------------------- |
13+
| `bucketName` | string | Name of the bucket to upload the object to. |
14+
| `objectKey` | string | Name of the uploaded object. |
15+
| `data` | string \| ArrayBuffer | Content of the object to upload. |
16+
| `params` | [PutObjectParams](#putobjectparams) (optional) | Options for the request. |
17+
18+
#### PutObjectParams
19+
20+
| Name | Type | Description |
21+
| :-------------------- | :---------------- | :---------- |
22+
| `contentDisposition` | string (optional) | Specifies presentational information for the object. For more information, see [RFC 6266](https://tools.ietf.org/html/rfc6266). |
23+
| `contentEncoding` | string (optional) | Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). |
24+
| `contentLength` | number (optional) | Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. |
25+
| `contentMD5` | string (optional) | The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can be used as a message integrity check to verify that the received message is identical to the message that was sent. |
26+
| `contentType` | string (optional) | A standard MIME type describing the format of the object data. For more information, see [RFC 2616](https://tools.ietf.org/html/rfc2616). |
1627

1728
### Returns
1829

@@ -40,7 +51,10 @@ const testFile = open('./bonjour.txt', 'r');
4051

4152
export default async function () {
4253
// Let's upload our test file to the bucket
43-
await s3.putObject(testBucketName, testFileKey, testFile);
54+
await s3.putObject(testBucketName, testFileKey, testFile, {
55+
contentType: 'text/plain',
56+
contentLength: testFile.length,
57+
});
4458

4559
// And let's redownload it to verify it's correct
4660
const obj = await s3.getObject(testBucketName, testFileKey);

0 commit comments

Comments
 (0)