Skip to content

Instantly share code, notes, and snippets.

@eai04191
Last active April 10, 2024 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eai04191/e896a5da0b968db69b59e77c7bd3a7b5 to your computer and use it in GitHub Desktop.
Save eai04191/e896a5da0b968db69b59e77c7bd3a7b5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GM_download test
// @author Eai <eai@mizle.net>
// @license MIT
// @version 1.0.0
// @match https://example.com/
// @grant GM_registerMenuCommand
// @grant GM_download
// ==/UserScript==
/* global GM_registerMenuCommand */
/* global GM_download */
function main() {
const sampleBlob = new Blob(["Hello, world!"], { type: "text/plain" });
const url = window.URL.createObjectURL(sampleBlob);
GM_download(url, "hello.txt");
}
(() => {
GM_registerMenuCommand("Download", main);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment