Unfortunately, as of this writing, Cloudflare Workers doesn't support the File
API and thus can't construct FormData
containing filenames and types, which is probably what you need here.
However, coincidentally, we're planning to roll out support for this very soon -- this week or next week. Once we've done that, you can construct your FormData
containing File
objects, like so:
let response = await fetch('https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/02_start_book_creator.png/640px-02_start_book_creator.png');
let data = await response.arrayBuffer();
let file = new File([data], "640px-02_start_book_creator.png", {type: "image/png"})
let formData = new FormData();
formData.append("file", file);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…