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/image-url.jpg?q=fetch&page=1119&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 13344 results for "fetch"(1611ms)

duckdbExamplemain.tsx2 matches

@hamilton•Updated 11 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let duckdbExample = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());
7 return new Worker(workerURL, { type: "module" });

duckdbExampleREADME.md1 match

@hamilton•Updated 11 months ago
1# DuckDB
2
3[DuckDB](https://duckdb.org/) works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from [jsdelivr](https://www.jsdelivr.com/).
4
5The only trick is to create the worker ourselves rather than using `duckdb.createWorker`. DuckDB's built-in createWorker method doesn't specify a worker type, which causes `type` to default to `classic`, and Deno (our runtime) doesn't support classic workers.

webPerformancemain.tsx1 match

@iamseeley•Updated 11 months ago
13async function measurePerformance(url) {
14 const start = Date.now();
15 const response = await fetch(url);
16 const ttfb = Date.now() - start;
17

fetchJSONmain.tsx5 matches

@stevekrouse•Updated 11 months ago
1import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";
2
3export const fetchJSON = async (
4 url: string | URL,
5 options?: RequestInit & {
6 bearer?: string;
7 fetch?: typeof fetch;
8 },
9) => {
17 headers.set("traceparent", traceparent);
18 }
19 let fetch = options?.fetch ?? globalThis.fetch;
20 let resp = await fetch(normalizeURL(url), {
21 redirect: "follow",
22 ...options,
28 }
29 catch (e) {
30 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${text}"`);
31 }
32};

nasaImageDetailsmain.tsx2 matches

@wallek•Updated 11 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const nasaImageDetails = async () => {
4 const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5 let nasaImageHtml = nasaAPOD.hdurl
6 ? `<img width="100%" src="${nasaAPOD.hdurl}"/>`

getYenPriceCronmain.tsx6 matches

@kayla_lin•Updated 11 months ago
1import { blob } from "https://esm.town/v/std/blob";
2import { fetch } from "https://esm.town/v/std/fetch";
3import xml2js from "npm:xml2js";
4
5async function fetchHistoricData() {
6 const currentDate = new Date();
7 const promises = [];
14 `https://www.floatrates.com/historical-exchange-rates.html?operation=rates&pb_id=1462&page=historical&currency_date=${formattedDate}&base_currency_code=JPY&format_type=xml`;
15
16 const fetchPromise = fetch(url)
17 .then((response) => {
18 if (!response.ok) {
40 .catch((error) => {
41 console.error(
42 "There has been a problem with your fetch operation:",
43 error,
44 );
46 });
47
48 promises.push(fetchPromise);
49 }
50
61
62export default async function(interval: Interval) {
63 const history = await fetchHistoricData();
64
65 await blob.setJSON("daily", history);

qdrantmain.tsx1 match

@dglazkov•Updated 11 months ago
30 const qdrantUrl = `https://${cluster_id}.cloud.qdrant.io${path}`;
31
32 const response = await fetch(qdrantUrl, {
33 method: req.method,
34 headers: req.headers,

fetchJSONmain.tsx5 matches

@maxm•Updated 11 months ago
1import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";
2
3export const fetchJSON = async (
4 url: string | URL,
5 options?: RequestInit & {
6 bearer?: string;
7 fetch?: typeof fetch;
8 },
9) => {
17 headers.set("traceparent", traceparent);
18 }
19 let fetch = options?.fetch ?? globalThis.fetch;
20 let resp = await fetch(normalizeURL(url), {
21 redirect: "follow",
22 ...options,
28 }
29 catch (e) {
30 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${text}"`);
31 }
32};

uptimemain.tsx2 matches

@stevekrouse•Updated 11 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

bookReservationOnResymain.tsx7 matches

@fshine99•Updated 11 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const bookReservationOnResy = async ({
145 )
146 }&password=${encodeURIComponent(params.password)}`;
147 const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
148 method: "POST",
149 body: body,
167 }) => {
168 const url = `${RESY_API_URL}/3/details`;
169 const response = await fetch(url.toString(), {
170 method: "POST",
171 headers: RESY_DEFAULT_HEADERS,
192 searchParams.set("party_size", params.seats.toString());
193 searchParams.set("venue_id", params.venueId);
194 const response = await fetch(`${url}?${searchParams}`, {
195 method: "GET",
196 headers: RESY_DEFAULT_HEADERS,
212 searchParams.set("url_slug", params.slug);
213 searchParams.set("location", params.city);
214 const response = await fetch(`${url}?${searchParams}`, {
215 method: "GET",
216 headers: RESY_DEFAULT_HEADERS,
224 authToken: string;
225 }) => {
226 const response = await fetch(`${RESY_API_URL}/3/book`, {
227 method: "POST",
228 headers: {
252 venueId,
253 });
254 console.log("Fetched available slots for day", {
255 count: slots.length,
256 times: slots.map((slot) => `${slot.date.start} -> ${slot.date.end}`),

GithubPRFetcher

@andybak•Updated 1 day ago

proxiedfetch1 file match

@jayden•Updated 2 days ago