import fetchPonyfill from 'fetch-ponyfill'; // input is without the prefix export const read = async (input: string) => { const { fetch } = fetchPonyfill({}); const response = await fetch(`https://${input}`, { method: 'GET', headers: { Accept: 'text/plain', }, }); const responseData = await response.text(); if (response.ok) { return responseData.split('\n\n'); } throw new Error(responseData); }; export const prefix = 'https://' as const;