UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

20 lines 684 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchFile = void 0; async function fetchFile(url, axios, text) { if (typeof window !== 'undefined' && typeof window.fetch !== 'undefined') { const response = await window.fetch(url); const data = await text ? response.text() : response.json(); return data; } const response = await axios.get(url, { responseType: text ? 'text' : 'json', responseEncoding: 'utf8', }); if (response.status !== 200) { throw new Error('request error!'); } return response.data; } exports.fetchFile = fetchFile; //# sourceMappingURL=utils.js.map