【发布时间】:2017-05-16 22:01:18
【问题描述】:
你好,
有人知道我如何将 .txt 写入 AWS Lambda 吗?我正在使用 Node.js、Alexa Skills Kit 和 Lambda。
我的代码:
var fs = require('fs');
const handlers = {
'SetOrderIntent': function() {
if (this.event.request.intent) {
var test = this.event.request.intent.slots.Items.value;
fs.writeFile('/tmp/log.txt', test, function (err) {
if (err) throw err;
});
this.emit(':ask', 'This is your item: ' + test, "Test");
}
},
'RetrieveOrderIntent': function() {
if (this.event.request.intent) {
fs.readFile('/tmp/log.txt', function (err, content) {
if (err) return callback(err)
callback(null, content)
})
this.emit(':ask', content);
}
},
}
【问题讨论】:
标签: aws-lambda alexa-skills-kit