Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Burl%7D?q=fetch&page=712&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8783 results for "fetch"(2083ms)

latestBlogContentmain.tsx2 matches

@simonw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function latestBlogContent() {
4 return (
5 await fetch(
6 "https://datasette.simonwillison.net/simonwillisonblog.json?_shape=array&sql=select+%27entry%27+as+type%2C+title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fe%2F%27+%7C%7C+id+as+url+from+blog_entry%0D%0Aunion+all%0D%0Aselect+%27blogmark%27+as+type%2C+link_title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fb%2F%27+%7C%7C+id+from+blog_blogmark%0D%0Aunion+all%0D%0Aselect+%27quotation%27+as+type%2C+source%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fq%2F%27+%7C%7C+id+from+blog_quotation%0D%0Aorder+by+created+desc"
7 )

openaiUploadFilemain.tsx2 matches

@yawnxyz•Updated 1 year ago
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: {

valTownSearchREADME.md1 match

@pomdtr•Updated 1 year ago
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 ?

reading_and_writing_blobsmain.tsx1 match

@pomdtr•Updated 1 year ago
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");

amberBuzzardmain.tsx3 matches

@gacanu•Updated 1 year ago
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;

atmos_washington_ssl_cert_errormain.tsx2 matches

@eagereyes•Updated 1 year ago
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

blueSwordfishmain.tsx2 matches

@stevekrouse•Updated 1 year ago
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);

blueSwordfishREADME.md1 match

@stevekrouse•Updated 1 year ago
1This is an example call of @stevekrouse/insecureFetch
2
3Migrated from folder: Archive/blueSwordfish

isMyWebsiteDownmain.tsx3 matches

@tylergalpin•Updated 1 year ago
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 }

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago