luke
luke
TTCTheo's Typesafe Cult
Created by Michael Schaufelberger on 8/9/2023 in #questions
"Body is unusable" or "fetch failed" when using server to upload Zip files
the solution seems to be doing it like this and adding the file.name
// Create a file from the buffer
const file = new Blob([pdfBuffer], { type: "application/pdf" });

// @ts-ignore
file.name = "markdown.pdf";

try {
const uploadedFile = await utapi.uploadFiles(file);
console.log("uploaded via utapi", uploadedFile);
} catch (e) {
console.log("Upload error:", e);
}
// Create a file from the buffer
const file = new Blob([pdfBuffer], { type: "application/pdf" });

// @ts-ignore
file.name = "markdown.pdf";

try {
const uploadedFile = await utapi.uploadFiles(file);
console.log("uploaded via utapi", uploadedFile);
} catch (e) {
console.log("Upload error:", e);
}
5 replies
TTCTheo's Typesafe Cult
Created by Michael Schaufelberger on 8/9/2023 in #questions
"Body is unusable" or "fetch failed" when using server to upload Zip files
Running into the same issue, did you find a solution?
5 replies