You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the request come with files and data the handler(ctx) function call twice but the response comes one time how we handle this. @icebob
My request payload is like below,
Payload : {
files[] : [file1,file2] ,
name : "testing"
}
My Functions is
async handler(ctx) {
console.log("ctx", "iam called", ctx.meta)
return new this.Promise((resolve, reject) => {
//reject(new Error("Disk out of space"));
if (ctx.meta.filename) {
const filePath = path.join(uploadDir, ctx.meta.filename || this.randomName());
const f = fs.createWriteStream(filePath);
f.on("close", () => {
// File written successfully
// console.log(`Uploaded file stored in '${filePath}'`);
resolve({ filePath, meta: ctx.meta });
});
ctx.params.on("error", err => {
console.log("File error received", err.message);
reject(err);
// Destroy the local file
f.destroy(err);
});
f.on("error", () => {
// Remove the errored file.
fs.unlinkSync(filePath);
});
ctx.params.pipe(f);
} else {
resolve({ meta: ctx.meta });
}
});
},
The text was updated successfully, but these errors were encountered:
When the request come with files and data the handler(ctx) function call twice but the response comes one time how we handle this. @icebob
My request payload is like below,
Payload : {
files[] : [file1,file2] ,
name : "testing"
}
My Functions is
The text was updated successfully, but these errors were encountered: