# @sec-ant/gm-fetch

> A fetch API for GM_xmlhttpRequest / GM.xmlHttpRequest

Latest version **1.2.5** (published 2026-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sec-ant/gm-fetch
pnpm add @sec-ant/gm-fetch
yarn add @sec-ant/gm-fetch
bun add @sec-ant/gm-fetch
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2026-07-05 |
| First published | 2023-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 14.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | Ze-Zheng Wu |
| Maintainers | sec-ant |
| Keywords | fetch, gm-fetch, GM_xmlhttpRequest, Tampermonkey, Violentmonkey, Greasemonkey, userscript |

## Links

- npm: https://www.npmjs.com/package/@sec-ant/gm-fetch
- Repository: https://github.com/Sec-ant/gm-fetch
- Issues: https://github.com/Sec-ant/gm-fetch/issues
- npm.io page: https://npm.io/package/@sec-ant/gm-fetch

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.2.5 (latest) — 2026-07-05
- 1.2.4 — 2026-04-29
- 1.2.3 — 2025-05-07
- 1.2.2 — 2025-04-30
- 1.2.1 — 2024-06-07
- 1.2.0 — 2023-09-13
- 1.1.6 — 2023-09-12
- 1.1.5 — 2023-09-12
- 1.1.4 — 2023-09-12
- 1.1.3 — 2023-09-12
- 1.1.2 — 2023-09-12
- 1.1.1 — 2023-09-12
- 1.1.0 — 2023-09-01
- 1.1.0-rc.1 — 2023-09-01
- 1.0.2 — 2023-09-01
- … 11 more at https://npm.io/package/@sec-ant/gm-fetch/versions

## README

# @sec-ant/gm-fetch

A fetch API for `GM_xmlhttpRequest` / `GM.xmlHttpRequest`.

## Features

- Use `responseType: stream` to prevent buffering large data when possible.
- Use Typescript.
- Provides es module, iife script and lib mode userscript as well.

## Install

If you use [vite-plugin-monkey](https://github.com/lisonge/vite-plugin-monkey):

```bash
npm i @sec-ant/gm-fetch
```

or just plain userscript (change `latest` to the version number as needed):

```js
// @require   https://cdn.jsdelivr.net/npm/@sec-ant/gm-fetch@latest/dist/index.iife.js
```

## Usage

1.  Grant necessary GM_APIs:

    vite-plugin-monkey:

    ```ts
    {
      plugins: [
        monkey({
          userscript: {
            // or GM.xmlHttpRequest
            grant: "GM_xmlhttpRequest",
            // whatever websites you're to make requests to
            connect: ["github.com"],
          },
        }),
      ];
    }
    ```

    plain userscript:

    ```js
    // @grant     GM_xmlhttpRequest
    // @connect   github.com
    ```

2.  Use it just like fetch:

    vite-plugin-monkey:

    ```ts
    import gmFetch from "@sec-ant/gm-fetch";

    gmFetch("https://github.com/Sec-ant/gm-fetch");
    ```

    plain userscript:

    ```js
    /* globals gmFetch */
    (function () {
      "use strict";
      gmFetch("https://github.com/Sec-ant/gm-fetch");
    })();
    ```

## License

MIT

---
_Source: https://npm.io/package/@sec-ant/gm-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
