How to use 'aws sdk putobject' in JavaScript

Every line of 'aws sdk putobject' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
22putObject (region, bucketName, objectName, body, mimeType = undefined, cacheControl = undefined) {
23 const awsS3 = new AWS.S3({ region })
24 return new Promise((resolve, reject) => {
25 if (mimeType === undefined) {
26 mimeType = mime.lookup(objectName)
27 }
28 if (cacheControl === undefined) {
29 cacheControl = getCacheControl(mimeType)
30 }
31 const params = {
32 Bucket: bucketName,
33 Body: body,
34 Key: objectName,
35 ContentType: mimeType,
36 CacheControl: cacheControl
37 }
38 awsS3.putObject(params, (err, result) => {
39 if (err) {
40 return reject(err)
41 }
42 resolve()
43 })
44 })
45}
43public putObject(
44 bucket: string,
45 key: string,
46 acl: string,
47 contentType: string,
48 body: string | BSON.Binary | Uint8Array | ArrayBuffer | Buffer
49): Promise {
50 return this.proxy.putObject(bucket, key, acl, contentType, body);
51}

Related snippets