Uploading a file is as simple as calling the `set` method with the file name and the file content.

import fs from "fs";
import { f0 } from "file0";

// Upload a json object
await f0.set("hello.json", JSON.stringify(myBigObject));

// Upload a text file from the file system
await f0.set("logs.txt", fs.readFileSync("./logs.txt"));

// Upload a blob
await f0.set("image.png", new Blob());

// You got the idea...
// It works with strings, any binary data type or streams.

Last updated