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/$%7Bsuccess?q=fetch&page=701&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 8588 results for "fetch"(1408ms)

fetch_example2main.tsx7 matches

@vladimyr•Updated 1 year ago
1import { fetch as fetch_ } from "https://esm.town/v/std/fetch?v=4";
2import { fetch } from "https://esm.town/v/vladimyr/fetch";
3import { createFetch } from "npm:ofetch";
4
5const ofetch = createFetch({ fetch });
6const ip = await ofetch("https://httpbun.com/ip.json");
7console.log(ip);
8
9{
10 console.log();
11 const ofetch = createFetch({ fetch: fetch_ });
12 const ip = await ofetch("https://httpbun.com/ip.json");
13 console.log(ip);
14}

fetch_examplemain.tsx4 matches

@vladimyr•Updated 1 year ago
1import { fetch as fetch_ } from "https://esm.town/v/std/fetch?v=4";
2import { fetch } from "https://esm.town/v/vladimyr/fetch";
3import ky from "npm:ky";
4
5const ip = await ky("https://httpbun.com/ip.json", { fetch }).json();
6console.log(ip);
7
8{
9 console.log();
10 const ip = await ky("https://httpbun.com/ip.json", { fetch: fetch_ }).json();
11 console.log(ip);
12}

getHashForUrlmain.tsx3 matches

@janpaul123•Updated 1 year ago
4// Retrieves the URL, and returns a hash of its contents.
5export async function getHashForUrl(url: string): Promise<string> {
6 // Fetch the content from the URL
7 const response = await fetch(url);
8 if (!response.ok) {
9 throw new Error(`Failed to fetch URL: ${url}`);
10 }
11 const data = await response.arrayBuffer();

sqlitemain.tsx2 matches

@std•Updated 1 year ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

fetchmain.tsx6 matches

@std•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { rawFetch } from "https://esm.town/v/std/rawFetch";
3
4/**
5 * Wraps the JavaScript Fetch function to anonymize where the request is
6 * coming from ([Docs ↗](https://docs.val.town/std/fetch))
7 *
8 * @param {string | URL} input - The URL to fetch
9 * @param {RequestInit} [requestInit] - Optional configuration data (HTTP
10 * method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
11 */
12export async function fetch(input: string | URL, requestInit?: RequestInit) {
13 let query = new URLSearchParams({
14 url: input.toString(),
15 });
16 return rawFetch(`${API_URL}/v1/fetch?${query}`, {
17 ...requestInit,
18 headers: {

email_docsmain.tsx1 match

@andreterron•Updated 1 year ago
61 attachments?: AttachmentData[];
62}) => {
63 let result = await fetch(
64 `${API_URL}/v1/email`,
65 {

sqlite_docsmain.tsx2 matches

@andreterron•Updated 1 year ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

blob_docsmain.tsx4 matches

@andreterron•Updated 1 year ago
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {

sqlite_adminmain.tsx1 match

@robsimmons•Updated 1 year ago
9app.get("/", async (c) => c.html(await sqlite_admin_tables()));
10app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
11export default basicAuth(app.fetch);

v1main.tsx1 match

@naserdehghan•Updated 1 year ago
11});
12
13export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago