I am trying to write and read to /temp dir in lambda during function execution, I know the best way would be to use S3, but for this project, I have to use node file system
const fs = require('fs');
exports.handler = async (event) => {
const path = '/tem/hi.json';
const write = (file) => {
fs.writeFile(file, "Hello World!", function(err) {
if (err) return console.log(err);
return {
statusCode:200,
body:JSON.stringify('data was written')
};
});
};
return write(path);
};