1var aws = require('aws-sdk');
2
3aws.config.update({
4 accessKeyId: AWS_ACCESS_KEY
5 secretAccessKey: AWS_SECRET_KEY
6});
7
8exports = module.exports = {
9 sign: function(filename, filetype) {
10 var s3 = new aws.S3();
11
12 var params = {
13 Bucket: SOME_BUCKET,
14 Key: filename,
15 Expires: 60,
16 ContentType: filetype
17 };
18
19 s3.getSignedUrl(‘putObject’, params, function(err, data) {
20 if (err) {
21 console.log(err);
22 return err;
23 } else {
24 return data;
25 }
26 });
27 }
28};