UNPKG

webextension-store-meta

Version:

Get browser extension(webextension) item meta from Chrome Web Store, Firefox add-ons, and Microsoft Edge Add-ons.

21 lines (16 loc) 423 B
import { fetch, type RequestInit } from "undici"; const DEFAULT_OPTIONS = { headers: { "User-Agent": "Mozilla/5.0", }, }; export const fetchText = async ( url: string, options: RequestInit = DEFAULT_OPTIONS, ): Promise<string> => { const response = await fetch(url, options); if (!response.ok) { throw new Error(`${response.status} ${response.statusText}: ${url}`); } return response.text(); };