Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { blob } from "https://esm.town/v/std/blob?v=3";
import Jimp from "npm:jimp";
export async function download(req: Request): Promise<Response> {
// Return the picture as a response
const searchParams = new URL(req.url).searchParams;
let paramsobj = Object.fromEntries(searchParams.entries());
const stored = await blob.get(paramsobj.url);
return new Response(stored.body, {
headers: {
"Content-Type": Jimp.MIME_PNG,
},
});
}
kutan-download.web.val.run
December 8, 2023