45/**
6* Provides functions for interacting with your account's blob storage.
7* Blobs can store any data type (text, JSON, images, etc.) and allow
8* retrieval across different vals using the same key.
80};
8182async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
94}
9596async function delete_(key: string) {
97const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98method: "DELETE",
107}
108109async function get(key: string) {
110const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111headers: {
123}
124125async function set(key: string, value: BodyInit | Response) {
126if (value instanceof Response) {
127value = value.body;
140}
141142async function copy(previous: string, next: string) {
143const res = await get(previous);
144await set(next, res.body);
145}
146147async function move(previous: string, next: string) {
148await copy(previous, next);
149await delete_(previous);
150}
151152async function getJSON(key: string) {
153try {
154const res = await get(key);
162}
163164async function setJSON(key: string, value: any) {
165return set(key, JSON.stringify(value));
166}
TODO_tootLatestPostsmain.tsx2 matches
34const found = new Set();
5export async function tootLatestPosts(interval: Partial<Interval>) {
6const { lastRunAt = "2023-04-04T00:00:00" } = interval || {};
7const lastRunDate = new Date(lastRunAt);
25import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
26import { parseXML } from "https://esm.town/v/stevekrouse/parseXML";
27function fetchRSS(url) {
28return fetchText(url)
29.then(parseXML)
1/**
2* Composes multiple functions into a single function that passes the result of each function to the next
3*
4* @param {...Function} funs The functions to compose
5* @returns {Function} A function that represents the composed functions
6*/
7export const pipe = (...funs) =>
fireworks_ai_proxymain.tsx2 matches
10};
1112function err(msg): Response {
13return new Response(
14JSON.stringify({
28}
2930export default async function(req: Request): Promise<Response> {
31const url = new URL(req.url);
32const pathname = url.pathname;
cors_proxymain.tsx1 match
6};
78export default async function(req: Request): Promise<Response> {
9// Check if the request is an OPTIONS request
10if (req.method === "OPTIONS") {
getHashForUrlmain.tsx1 match
23// Retrieves the URL, and returns a hash of its contents.
4export async function getHashForUrl(url: string): Promise<string> {
5// Fetch the content from the URL
6const response = await fetch(url);
fetch_docsmain.tsx2 matches
23/**
4* Wraps the JavaScript Fetch function to anonymize where the request is
5* coming from ([Docs ↗](https://docs.val.town/std/fetch))
6*
9* method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
10*/
11export async function fetch(input: string | URL | Request, requestInit?: RequestInit) {
12const origReq = new Request(input, requestInit);
13const url = new URL("/v1/fetch", API_URL);
23/**
4* Wraps the JavaScript Fetch function to anonymize where the request is
5* coming from ([Docs ↗](https://docs.val.town/std/fetch))
6*
9* method, headers, etc) ([Docs ↗](https://deno.land/api@v1.42.1?s=RequestInit))
10*/
11export async function fetch(input: string | URL | Request, requestInit?: RequestInit) {
12const origReq = new Request(input, requestInit);
13const url = new URL("/v1/fetch", API_URL);
3import { email } from "https://esm.town/v/std/email?v=12";
45export default async function(interval: Interval) {
6const dynamiclandWebsiteHash = await blob.getJSON("dynamiclandWebsiteHash");
7const newHash = await getHashForUrl("https://dynamicland.org/");
getHashForUrlmain.tsx1 match
34// 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
7const response = await fetch(url);