Every line of 'aws sdk s3 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.
22 putObject (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 }
43 public 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 }
5 function createBucket(bucket) { 6 return awsRequest('S3', 'createBucket', { Bucket: bucket }); 7 }
43 export function getObject (s3, params) { 44 return s3.getObject(params).promise(); 45 };