1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
5// Forked from @iBrokeit.nasaAPOD
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export async function polygonDailyAPI(ticker, date) {
5 return fetchJSON(
6 `https://api.polygon.io/v1/open-close/${ticker}/${date}?adjusted=true&apiKey=${process.env.POLYGON_API_KEY}`
7 );
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);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let tldrawStars = fetchJSON("https://api.github.com/repos/tldraw/tldraw")
4 .then(
5 (resp) =>
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 {
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};
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);
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: {
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);
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);