Created
February 10, 2016 10:17
-
-
Save mariokostelac/fa298beef7450b011c18 to your computer and use it in GitHub Desktop.
Lambda with FS operations
This file contains 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 characters
var fs = require('fs'); | |
var filename = "/tmp/test"; | |
exports.handler = function(event, context) { | |
fs.writeFile(filename, JSON.stringify(context), function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
fs.readFile(filename, function(err, data) { | |
if (err) { | |
throw err; | |
} | |
context.succeed(data.toString('utf8')); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment