Last active
December 2, 2017 19:56
-
-
Save jpfong/bc11159e31edb3380551d4ab778f9a6b to your computer and use it in GitHub Desktop.
Revisions
-
jpfong revised this gist
Dec 2, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,8 @@ const aws = require('aws-sdk'); const s3 = new aws.S3(); var params = { Bucket: 'bucket_name', Key: 'file.png', // if you want to put in a directory, the key would be: 'directory_name/file_name.ext' ACL: 'public-read', // to allow to access the file Body: data // the data of the file }; -
jpfong created this gist
Dec 2, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ const aws = require('aws-sdk'); const s3 = new aws.S3(); var params = { Bucket: process.env.S3_BUCKET_NAME, Key: 'file.png', // if in a directory, the key would be: 'directory_name/file_name.ext' ACL: 'public-read', // to allow to access the file Body: data // the data of the file }; s3.putObject(params, (err, data) => { if (err) { console.error('Error uploading image: ', err); } else { console.log(data); } });