Uploading file from AWS Lambda
sanjiv221 opened this issue · comments
I need to upload a file from AWS Lambda using filestack-js module. File will come to lambda as an attachment in request from the client. When I call Lambda from POSTMAN, I get the file in string format. what format should I convert the string to and pass that to client.upload? Language I am using is typescript. I am doing something like below but it gives error when creating Blob. I will try to fix it if filestack will accept the file in the format I am passing
let blob = new Blob([request.body], { type: 'text/plain' });
console.log("after creating blob")
let file = new File([blob], "foo.txt", {type: "text/plain"});
console.log("after creating file onject")
const client = filestack.init("Your API Key");
client.upload(file).then(data =>console.log(data.url));
NodeJS version I am using is v14.17.6
Hello,
I have been able to upload a text file from AWS lambda using the code:
const client = filestack.init("your api key");
await client.upload("/tmp/test.txt", {}, { filename: 'text.txt' }).then(data =>console.log(data.url));
but the url that I receive shows the content on the browser instead of downloading the file. Please help.
Should I ask these questions to another forum?