import { fileFrom } from "npm:fetch-blob/from.js";
async function run() {
const file = await fileFrom("./sample.txt");
const fd = new FormData();
fd.append("file", file);
const res = await fetch("https://httpbin.org/anything/upload", {
method: "POST",
body: fd,
});
console.log(await res.json());
}
run();
import { fileFrom } from "npm:fetch-blob/from.js";
async function run() {
const file = await fileFrom("./sample.txt");
const fd = new FormData();
fd.append("file", file);
const res = await fetch("https://httpbin.org/anything/upload", {
method: "POST",
body: fd,
});
console.log(await res.json());
}
run();