Skip to content

Instantly share code, notes, and snippets.

@5ouma
Last active December 12, 2025 12:17
Show Gist options
  • Select an option

  • Save 5ouma/92b4478ed374ce42a6222315d35a3bf1 to your computer and use it in GitHub Desktop.

Select an option

Save 5ouma/92b4478ed374ce42a6222315d35a3bf1 to your computer and use it in GitHub Desktop.
πŸ”€ Download decomoji images from collected JSON file
import { basename } from "jsr:@std/path";
import {
array,
object,
parse,
pipe,
regex,
string,
} from "jsr:@valibot/valibot";
const baseUrl =
"https://raw.githubusercontent.com/decomoji/decomoji/refs/heads/main";
const dir = "decomoji";
const decomojiSchema = array(
object({ path: pipe(string(), regex(/^decomoji\/(basic|extra).+\.png$/)) }),
);
const data = Deno.readTextFileSync("my-collected.json");
const decomojis = parse(decomojiSchema, JSON.parse(data));
Deno.mkdirSync(dir, { recursive: true });
for (const decomoji of decomojis) {
const url = `${baseUrl}/${decomoji.path}`;
const response = await fetch(url);
if (!response.ok) {
console.error(`Failed to download ${url}`);
continue;
}
Deno.writeFileSync(
`${dir}/${basename(decomoji.path).replaceAll("-", "_")}`,
new Uint8Array(await response.arrayBuffer()),
);
}
@5ouma
Copy link
Author

5ouma commented Nov 14, 2025

  1. Download the decomoji JSON file from decomoji finder
  2. Run this script to download images
    deno x https://gist.githubusercontent.com/5ouma/92b4478ed374ce42a6222315d35a3bf1/raw/download-decomoji.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment