CLI for Oblique Strategies.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
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;