CLI for Oblique Strategies.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

23 rader
483 B

  1. import fetchPonyfill from 'fetch-ponyfill';
  2. // input is without the prefix
  3. export const read = async (input: string) => {
  4. const { fetch } = fetchPonyfill({});
  5. const response = await fetch(`https://${input}`, {
  6. method: 'GET',
  7. headers: {
  8. Accept: 'text/plain',
  9. },
  10. });
  11. const responseData = await response.text();
  12. if (response.ok) {
  13. return responseData.split('\n\n');
  14. }
  15. throw new Error(responseData);
  16. };
  17. export const prefix = 'https://' as const;