Global Key-Value Store.beta

File Storage

gokv provides a static file storage and global content delivery network (CDN). You can use it to upload static files or images, and get the optimized global CDN url. It works in Deno, Node.js and browsers.

import gokv from "https://deno.land/x/gokv@0.0.23/mod.ts";

// get the file storage
const fs = gokv.FileStorage();

// for pro users, you can use namespace to separate your data
const fs = gokv.FileStorage({ namespace: "xxx" });

// upload a file
const file = new File(["Hello world!"], "hello.txt", { type: "text/plain" });
const { url } = await fs.upload(file); // url -> https://file.gokv.io/xxx-xxx-xxx-xxx

Upload Images

You can upload images to the file storage, gokv will optimize those images automatically. More details please check the images documentation.

import gokv from "https://deno.land/x/gokv@0.0.23/mod.ts";

const fs = gokv.FileStorage();
const image = new File(
  [await Deno.readFile("./image.png")],
  "image.png",
  { type: "image/png" },
);
const { url } = await fs.upload(image); // url -> https://img.gokv.io/xxx-xxx-xxx-xxx