{"id":15496828,"url":"https://github.com/ahkohd/thumbo","last_synced_at":"2026-03-08T12:31:12.338Z","repository":{"id":46336280,"uuid":"420842963","full_name":"ahkohd/thumbo","owner":"ahkohd","description":"High-performance thumbnail library for browsers. Built with Rust 🦀 and WebAssembly 🕸","archived":false,"fork":false,"pushed_at":"2025-06-08T18:00:15.000Z","size":27466,"stargazers_count":20,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-08T19:18:06.876Z","etag":null,"topics":["image","rust","thumbnail","video","wasm","wasm-pack","webassembly"],"latest_commit_sha":null,"homepage":"https://thumbo.netlify.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahkohd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-25T01:39:35.000Z","updated_at":"2025-05-02T15:23:09.000Z","dependencies_parsed_at":"2023-12-15T21:43:23.325Z","dependency_job_id":"6ec622e8-0368-4c65-b4fa-d215e861af3c","html_url":"https://github.com/ahkohd/thumbo","commit_stats":{"total_commits":64,"total_committers":1,"mean_commits":64.0,"dds":0.0,"last_synced_commit":"c535dc1d9b8349de94e820287f236dae00dd9f3b"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ahkohd/thumbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkohd%2Fthumbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkohd%2Fthumbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkohd%2Fthumbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkohd%2Fthumbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahkohd","download_url":"https://codeload.github.com/ahkohd/thumbo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahkohd%2Fthumbo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259509473,"owners_count":22868835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","rust","thumbnail","video","wasm","wasm-pack","webassembly"],"created_at":"2024-10-02T08:28:45.367Z","updated_at":"2026-03-08T12:31:12.308Z","avatar_url":"https://github.com/ahkohd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n  \u003ch1\u003e\u003ccode\u003ethumbo\u003c/code\u003e\u003c/h1\u003e\n\n\u003cstrong\u003eA high-performant thumbnail creation library\u003c/strong\u003e\n\n[![Build \u0026 Test](https://github.com/ahkohd/thumbo/actions/workflows/build.yml/badge.svg)](https://github.com/ahkohd/thumbo/actions/workflows/build.yml)\n\n\u003csub\u003eBuilt with Rust 🦀 \u0026 WebAssembly 🕸\u003c/sub\u003e\n\n\u003c/div\u003e\n\n## ✅ Features\n\n- High-performance\n- Web worker pool\n- Built with Rust \u0026 Web Assembly\n- Uses transferable objects\n- Easy to use APIs\n- Supports `Png`, `Jpeg`, `Gif`, `Ico` and `Svg`\n\n## 🚴 Usage\n\nInstall the package from npm:\n\n```bash\npnpm add thumbo\n```\n\n```ts\nimport Thumbo, { Transfer } from \"thumbo\";\n\nThumbo.init().then(async () =\u003e {\n  Thumbo.thumbnail(\n    Transfer(await (await fetch(\"/path/to/img.png\")).arrayBuffer()),\n    Thumbo.ImageFormat.Png,\n    20,\n    20\n  ).then((thumbnailBuffer) =\u003e {\n    document.getElementById(\"img1\").src = URL.createObjectURL(\n      new Blob([thumbnailBuffer])\n    );\n  });\n\n  Thumbo.thumbnailFromUrl(\n    \"https://example.com/image.png\",\n    Thumbo.ImageFormat.Png,\n    20,\n    20\n  ).then((thumbnailBuffer) =\u003e {\n    document.getElementById(\"img2\").src = URL.createObjectURL(\n      new Blob([thumbnailBuffer])\n    );\n  });\n});\n```\n\n## ⚙️ API Reference\n\n### \u003cspan id=\"thumbo_image_format\"\u003eThumbo.init(config: [InitOptions](#initoptions)): Promise\\\u003cvoid\\\u003e\u003c/span\u003e\n\nInitiates thumbo. The initiation proccess includes:\n\n- Downloads the [thumbo-core](https://github.com/ahkohd/thumbo-core) WebAssembly bundle from [unpkg.com](https://unpkg.com/thumbo-core/pkg/thumbo_core_bg.wasm)\n- Complies the WASM binary\n- Starts a pool of web workers(8 workers are pooled by default, however, you can control the number of wokers to be spawned) to take thumbnail creation tasks\n- After the afore mentioned steps are completed, `isInitialized` field is set `true`.\n\n#### \u003cspan id=\"initoptions\"\u003eInitOptions\u003c/span\u003e\n\n`InitOptions` interface provides the configuration for the `init` method.\n\n```ts\ninterface InitOptions {\n  /** Url to fetch the thumbo-core WASM bundle. Defaults to the bundle hosted on unpkg. */\n  wasmUrl?: string;\n  /** Maximum no. of tasks to run on one worker thread at a time. Defaults to one. */\n  concurrency?: number;\n  /** Maximum no. of jobs to be queued for execution before throwing an error. */\n  maxQueuedJobs?: number;\n  /** Gives that pool a name to be used for debug logging, letting you distinguish between log output of different pools. */\n  name?: string;\n  /** No. of worker threads to spawn and to be managed by the pool. */\n  size?: number;\n}\n```\n\n### \u003cspan id=\"transfer\"\u003eTransfer(transferable: [Transferable](https://developer.mozilla.org/de/docs/Web/API/Transferable)): TransferDescriptor\u003c/span\u003e\n\nMark transferable objects within an arbitrary object or array as\nbeing a transferable object. They will then not be serialized\nand deserialized on messaging with the main thread, but ownership\nof them will be tranferred to the receiving thread.\n\nOnly array buffers, message ports and few more special types of\nobjects can be transferred, but it's much faster than serializing and\ndeserializing them.\n\nReturns a \u003cspan id=\"transferdescriptor\"\u003e`TransferDescriptor`\u003c/span\u003e, a container that holds the arraybuffer to be transferred.\n\n\u003e Note:\n\u003e The transferable object cannot be accessed by this thread again\n\u003e unless the receiving thread transfers it back again!\n\n**Transferable**: transferable Array buffer, message port or similar.\n\nSee \u003chttps://developers.google.com/web/updates/2011/12/Transferable-Objects-Lightning-Fast\u003e\n\n### \u003cspan id=\"imageformat\"\u003eThumbo.ImageFormat\u003c/span\u003e\n\nEnums of supported image formats. Thumbo supports thumbnail creation for the following formats:\n\n- Png\n- Jpeg\n- Gif\n- Ico\n- Svg\n\n### \u003cspan id=\"thumbo_thumbnail\"\u003eThumbo.thumbnail(bufferDescriptor: [TransferDescriptor](#transferdescriptor), format: [ImageFormat](#imageformat), width: number, height: number): Promise\\\u003cArrayBuffer\\\u003e\u003c/span\u003e\n\nCreates a thumbnail from the provided arraybuffer transfer descriptor.\nThe provided arraybuffer is transferred to the worker for processing, once the task is completed, the newly created thumbnail arraybuffer\nis transferred back to the main thread.\n\n### \u003cspan id=\"thumbo_thumbnailFromUrl\"\u003eThumbo.thumbnailFromUrl(url: string, format: [ImageFormat](#imageformat), width: number, height: number): Promise\\\u003cArrayBuffer\\\u003e\u003c/span\u003e\n\nCreates a thumbnail from the provided `Url`. Once the task is completed, the created thumbnail arraybuffer is transferred to the main thread.\n\n### \u003cspan id=\"thumbo_workers\"\u003eThumbo.workers\u003c/span\u003e\n\nReturns the workers in the pool\n\n\u003e Note:\n\u003e Accessing this property before thumbo is initialized will throw an error.\n\n### \u003cspan id=\"thumbo_completed\"\u003eThumbo.completed(allowResolvingImmediately: boolean)\u003c/span\u003e\n\nReturns a promise that resolves once the task queue is emptied.\nPromise will be rejected if any task fails.\n\n`allowResolvingImmediately` Set to `true` to resolve immediately if task queue is currently empty.\n\n### \u003cspan id=\"thumbo_settled\"\u003eThumbo.settled(allowResolvingImmediately: boolean)\u003c/span\u003e\n\nReturns a promise that resolves once the task queue is emptied.\nFailing tasks will not cause the promise to be rejected.\n\n`allowResolvingImmediately` Set to `true` to resolve immediately if task queue is currently empty.\n\n\u003e Note:\n\u003e Calling this function before thumbo is initialized will throw an error.\n\n### \u003cspan id=\"thumbo_uninit\"\u003eThumbo.uninit(force: boolean)\u003c/span\u003e\n\nReturns a promise that resolves once the task queue is emptied.\nFailing tasks will not cause the promise to be rejected.\n\n`force` Set to `true` to kill the thread even if it cannot be stopped gracefully.\n\n\u003e Note:\n\u003e Calling this function before thumbo is initialized will throw an error.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahkohd%2Fthumbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahkohd%2Fthumbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahkohd%2Fthumbo/lists"}