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=754&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 7887 results for "fetch"(1505ms)

slackReplyToMessagemain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import process from "node:process";
3
16 // Note: `body.event` has information about the event
17 // like the sender and the message text
18 const result = await fetchJSON(
19 "https://slack.com/api/chat.postMessage",
20 {

fetchJSONmain.tsx4 matches

@sean•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchJSON = async <T = any>(url: string, options?: any): Promise<T> => {
4 try {
5 const response = await fetch(url, {
6 ...options,
7 headers: {
13 return response.json();
14 } catch (error) {
15 throw new Error(`${error.message} in fetch ${url}."`);
16 }
17};

extractTextmain.tsx2 matches

@Llad•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function extractText(data, name) {
4 const fileUrl =
5 "https://www.gcmgrosvenor.com/wp-content/uploads/Private-Credit-Co-investing-GCM-Grosvenor.pdf";
6 const blob = await fetch(fileUrl).then((r) => r.blob());
7 const pdfjs = await import("npm:pdfjs-dist"); //https://www.npmjs.com/package/pdf-to-text
8 return Object.keys(pdfjs);

fetchXMLmain.tsx3 matches

@eczajk•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchXML = async (url: string, options?: any) => {
4 let f = await fetch(url, {
5 ...options,
6 headers: {

githubUsermain.tsx2 matches

@axel_sb•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/stevekrouse"
6);

githubFollowersmain.tsx2 matches

@roald87•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub followers
4export let githubFollowers = fetchJSON(
5 "https://api.github.com/users/stevekrouse/followers"
6);

dlockmain.tsx5 matches

@karfau•Updated 1 year ago
21 // seconds
22 ttl?: number;
23} = {}, _fetch = fetch): Promise<Lock> {
24 if (!id) {
25 id = mainReference(({ userHandle, valName }) =>
48 const release = async () =>
49 !isExpired() &&
50 void _fetch(
51 `https://dlock.univalent.net/lock/${id}/release?${
52 searchParams({ lease: _lease })
57 throw new Error("lock is expired");
58 }
59 return _fetch(
60 `https://dlock.univalent.net/lock/${id}/aquire?${
61 searchParams({ lease: _lease, ttl })
72 const acquire = async (max = Date.now() + ttl * 1000): Promise<Lock> => {
73 try {
74 const lockRes = await _fetch(
75 `https://dlock.univalent.net/lock/${id}/aquire?${
76 searchParams({ lease: _lease, ttl })
117 else {
118 // the code might reach here in "no time",
119 // in case _fetch threw an error synchronously (e.g. network error)
120 // so we debounce to a max of 5 attempts (ttl * 1000 is the max time for retries)
121 await sleep(throttleMs);

big_story_visualizationmain.tsx1 match

@tmcw•Updated 1 year ago
24 import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.9/+esm";
25 import {debounce} from "https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm";
26 const ranks = await (await fetch('https://api.val.town/v1/run/tmcw.big_stories_ranks')).json();
27
28 let allDates = new Set();

privateAPIAuthenticatedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export const privateAPIAuthenticated = fetchJSON(
5 "https://api.val.town/v1/run/stevekrouse.example3",
6 {

myIPmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const myIP = () =>
4 fetchJSON("https://api.ipify.org?format=json");

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago