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/?q=fetch&page=493&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 8288 results for "fetch"(911ms)

JokeGeneratorRealmain.tsx4 matches

@anoushkaabroal•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

scribemain.tsx12 matches

@yawnxyz•Updated 5 months ago
44}
45
46// Fetch the size of the file using HTTP HEAD request
47export async function fetchFileSize(url: string): Promise<number> {
48 const response = await fetch(url, { method: 'HEAD' });
49 const contentLength = response.headers.get('content-length');
50 return contentLength ? parseInt(contentLength, 10) : 0;
98 } else {
99 const url = input.content as string;
100 fileSize = await fetchFileSize(url);
101
102 // For URLs, create buffer getter that fetches ranges
103 getBuffer = async (start: number, end: number) => {
104 const response = await fetch(url, {
105 headers: { Range: `bytes=${start}-${end}` },
106 });
107 if (!response.ok && response.status !== 206) {
108 throw new Error(`Failed to fetch range ${start}-${end}: ${response.statusText}`);
109 }
110 const arrayBuffer = await response.arrayBuffer();
393 const body = await c.req.json();
394 if (body.url) {
395 const response = await fetch(body.url);
396 const blob = await response.blob();
397 file = new File([blob], 'audio.wav', { type: response.headers.get('content-type') || 'audio/wav' });
664 if (sessionToken) {
665 try {
666 const response = await fetch(`${AUTH_SERVICE_URL}/api/auth/user`, {
667 headers: {
668 'Cookie': cookies,
753
754 try {
755 await fetch("https://auth.labspace.ai/logout", {
756 method: 'POST',
757 credentials: 'include',
1395});
1396
1397// Export app.fetch for Val Town, otherwise export app
1398export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
1399// export default app;

constantPeachPorcupinemain.tsx4 matches

@ozhao1323•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

superiorYellowSnailmain.tsx3 matches

@blaisehub•Updated 5 months 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;

energeticLimeStoatmain.tsx4 matches

@edyi8•Updated 5 months ago
1// ... imports ...
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

balancedYellowMousemain.tsx3 matches

@ozhao1323•Updated 5 months 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;

spotlessJadeBarracudamain.tsx3 matches

@emmagershman•Updated 5 months ago
4};
5
6// Fetches a random joke.
7function fetchRandomJoke() {
8 const SAMPLE_JOKE = {
9 "setup": "What do you call a group of disorganized cats?",
14}
15
16const randomJoke = fetchRandomJoke();
17const setup = randomJoke.setup;
18const punchline = randomJoke.punchline;

Joke_Generatormain.tsx4 matches

@n3umaster•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2// Fetches a random joke.
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",
6 );
8}
9
10const randomJoke = await fetchRandomJoke();
11const setup = randomJoke.setup;
12const punchline = randomJoke.punchline;

responsibleFuchsiaImpalamain.tsx4 matches

@nunnyu•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

curiousMagentaFalconmain.tsx3 matches

@emanneu•Updated 5 months 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;

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago