Last active
December 17, 2017 08:30
-
-
Save grimmerk/d0fcb18f155e64261ba5dd22f5eddb49 to your computer and use it in GitHub Desktop.
AWS lambda example to write/read, ref: https://stackoverflow.com/a/35007461/7354486
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
// ref: https://stackoverflow.com/a/35007461/7354486 | |
var tester = require("./test.js"); | |
console.log("test2"); | |
console.log("first line2"); | |
exports.handler3 = (event, context, callback) => { | |
console.log("event2:", event); | |
tester.test5(); | |
// TODO implement | |
// callback(null, 'Hello from2'); | |
}; | |
var fs = require("fs"); | |
exports.testIO = function(event, context) { | |
const fileName = "/tmp/test.txt"; | |
fs.writeFile(fileName, "testing", function (err) { | |
if (err) { | |
context.fail("writeFile failed: " + err); | |
} else { | |
context.succeed("writeFile succeeded"); | |
//read it | |
// const houseprice = JSON.parse(fs.readFileSync(fileName, 'utf8')); | |
const houseprice = fs.readFileSync(fileName, 'utf8'); | |
console.log("price:", houseprice); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment