1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, filename = "data.json", purpose = "assistants" }: {
17 formData.append("purpose", purpose);
18 formData.append("file", file, filename);
19 let result = await fetch("https://api.openai.com/v1/files", {
20 method: "POST",
21 headers: {
5Either use the provided UI, or the query param:
6
7<https://val-town-search.pomdtr.me/search?q=fetchJSON>
8
9## How does it work ?
16
17// The lower level set and get can be used to store non-JSON or binary data.
18const resp = await fetch("https://picsum.photos/600/300");
19await blob.set("image", resp.body);
20const image = await blob.get("image");
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 const SAMPLE_JOKE = {
6 "setup": "What do you call a group of disorganized cats?",
10}
11
12const randomJoke = fetchRandomJoke();
13const setup = randomJoke.setup;
14const punchline = randomJoke.punchline;
1import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
2
3const url = "https://atmos.washington.edu/cgi-bin/uw.cgi?20240408";
4const data = await insecureFetch(url);
5const text = await data.text();
6console.log(text);
1This is an example call of @stevekrouse/insecureFetch
1import { fetch } from "https://esm.town/v/std/fetch?v=5";
2
3const url = "https://atmos.washington.edu/cgi-bin/uw.cgi?20240408";
4const data = await fetch(url);
5const text = await data.text();
6console.log(text);
1This is an example call of @stevekrouse/insecureFetch
2
3Migrated from folder: Archive/blueSwordfish
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export default async () => {
8 let reason: string;
9 try {
10 const res = await fetch(URL);
11 if (res.status !== 200) {
12 reason = `(status code: ${res.status})`;
14 }
15 } catch (e) {
16 reason = `couldn't fetch: ${e}`;
17 ok = false;
18 }
1import { blob } from "https://esm.town/v/std/blob?v=11";
2import { email } from "https://esm.town/v/std/email?v=11";
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
4import { JSDOM } from "npm:jsdom";
5
8export default async function(interval: Interval) {
9 const url = "https://news.ycombinator.com/threads?id=" + username;
10 const html = await fetchText(url);
11
12 console.log("html", html.slice(0, 100));