你正在訪問的內容是外部程式的映像位址,僅用於使用者加速訪問,本站無法保證其可靠性。當前的連結位址(單點即可複製)為 https://greasyfork.org.cn/zh-CN/scripts/472236-gm-fetch,源站連結 點此以跳轉。
A fetch API for GM_xmlhttpRequest / GM.xmlHttpRequest
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.org.cn/scripts/472236/1585366/GM%20Fetch.js
A fetch API for GM_xmlhttpRequest / GM.xmlHttpRequest.
responseType: stream to prevent buffering large data when possible.If you use vite-plugin-monkey:
npm i @sec-ant/gm-fetch
or just plain userscript (change latest to the version number as needed):
// @require https://cdn.jsdelivr.net/npm/@sec-ant/gm-fetch@latest/dist/index.iife.js
Grant necessary GM_APIs:
vite-plugin-monkey:
{
plugins: [
monkey({
userscript: {
// or GM.xmlHttpRequest
grant: "GM_xmlhttpRequest",
// whatever websites you're to make requests to
connect: ["github.com"],
},
}),
];
}
plain userscript:
// @grant GM_xmlhttpRequest
// @connect github.com
Use it just like fetch:
vite-plugin-monkey:
import gmFetch from "@sec-ant/gm-fetch";
gmFetch("https://github.com/Sec-ant/gm-fetch");
plain userscript:
/* globals gmFetch */
(function () {
"use strict";
gmFetch("https://github.com/Sec-ant/gm-fetch");
})();
MIT