UNPKG

webextension-store-meta

Version:

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

21 lines (16 loc) 423 B
import { type RequestInit, fetch } 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(); };