summaryrefslogtreecommitdiff
path: root/handler.js
diff options
context:
space:
mode:
Diffstat (limited to 'handler.js')
-rw-r--r--handler.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/handler.js b/handler.js
index ad6eb1d..458d12d 100644
--- a/handler.js
+++ b/handler.js
@@ -6,8 +6,10 @@ const AWS = require('aws-sdk'); // eslint-disable-line import/no-extraneous-depe
const s3 = new AWS.S3();
module.exports.save = (event, context, callback) => {
- console.log(event.Records[0].kinesis);
- var url = new Buffer(event.Records[0].kinesis.data, 'base64').toString('utf8');
+ event.Records.forEach(function(record) {
+ console.log(record.kinesis.data);
+
+ var url = new Buffer(record.kinesis.data, 'base64').toString('utf8');
console.log(url);
fetch(url)
.then((response) => {
@@ -26,4 +28,5 @@ module.exports.save = (event, context, callback) => {
}).promise()
))
.then(v => callback(null, v), callback);
+ });
};