{"_id":"@discourse/gif","name":"@discourse/gif","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@discourse/gif","version":"1.0.0","main":"index.js","description":"Wasm GIF decoder supporting the browser. Decode GIF images to ImageData.","repository":{"type":"git","url":"git+https://github.com/discourse/jSquash.git"},"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","gif"],"license":"Apache-2.0","scripts":{"clean":"rm -rf dist","build:codec":"cd codec && npm run build","build":"npm run clean && tsc && cp -r codec package.json README.md .npmignore ../../LICENSE dist && cd dist/codec","prepublishOnly":"[[ \"$PWD\" == *'/dist' ]] && exit 0 || (echo 'Please run npm publish from the dist directory' && exit 1)"},"devDependencies":{"@types/node":"^20.9.2","typescript":"^4.4.4"},"type":"module","sideEffects":false,"publishConfig":{"access":"public"},"_id":"@discourse/gif@1.0.0","gitHead":"345892e0e48b428d47875a5b5678fbcf58f2880e","types":"./index.d.ts","bugs":{"url":"https://github.com/discourse/jSquash/issues"},"homepage":"https://github.com/discourse/jSquash#readme","_nodeVersion":"24.5.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-hh4EI0yoNWDuPp0CC/8N1NiUcwsCznTXrIefODxHP/c3hE97N9z2RkyKfhINEaTfiWoZx3XyOujDn6L0Pm8nRQ==","shasum":"00fb04307a59fcba3a12caeb49e242b016fb6cd3","tarball":"https://registry.npmjs.org/@discourse/gif/-/gif-1.0.0.tgz","fileCount":14,"unpackedSize":73368,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCmMq45IF3yz12xDGaU11IjYqRv20bvBuEiIZ0FUF/3HgIgePY2N9lgUI4tgA5dTaH/zYnAmasw4/K7aeaw59B1Kjs="}]},"_npmUser":{"name":"falcofantastic","email":"rafael@discourse.org"},"directories":{},"maintainers":[{"name":"cvx-pl","email":"jarek@cvx.dev"},{"name":"discourse-npm","email":"team@discourse.org"},{"name":"sam.saffron","email":"sam.saffron@gmail.com"},{"name":"joffreyjaffeux","email":"j.jaffeux@gmail.com"},{"name":"pmusaraj","email":"pmusaraj@gmail.com"},{"name":"davidtaylorhq","email":"david@taylorhq.com"},{"name":"keegangeorge","email":"kgeorge13@gmail.com"},{"name":"falcofantastic","email":"rafael@discourse.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gif_1.0.0_1778182020963_0.9306719879725165"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T19:27:00.875Z","1.0.0":"2026-05-07T19:27:01.106Z","modified":"2026-05-07T19:27:01.782Z"},"maintainers":[{"name":"cvx-pl","email":"jarek@cvx.dev"},{"name":"discourse-npm","email":"team@discourse.org"},{"name":"sam.saffron","email":"sam.saffron@gmail.com"},{"name":"joffreyjaffeux","email":"j.jaffeux@gmail.com"},{"name":"pmusaraj","email":"pmusaraj@gmail.com"},{"name":"davidtaylorhq","email":"david@taylorhq.com"},{"name":"keegangeorge","email":"kgeorge13@gmail.com"},{"name":"falcofantastic","email":"rafael@discourse.org"}],"description":"Wasm GIF decoder supporting the browser. Decode GIF images to ImageData.","homepage":"https://github.com/discourse/jSquash#readme","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","gif"],"repository":{"type":"git","url":"git+https://github.com/discourse/jSquash.git"},"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"bugs":{"url":"https://github.com/discourse/jSquash/issues"},"license":"Apache-2.0","readme":"# @jsquash/gif\n\n[![npm version](https://badge.fury.io/js/@jsquash%2Fgif.svg)](https://badge.fury.io/js/@jsquash%2Fgif)\n\nAn easy way to decode GIF images in the browser with WebAssembly.\n\nUses the [Rust gif crate](https://docs.rs/gif).\n\nA [jSquash](https://github.com/jamsinclair/jSquash) package.\n\n## Installation\n\n```shell\nnpm install --save @jsquash/gif\n```\n\n## Usage\n\nNote: You will need to either manually include the wasm files from the codec directory or use a bundler like WebPack or Rollup to include them in your app/server.\n\n### `decode(data: ArrayBuffer): Promise<ImageData>`\n\nDecodes GIF binary data to `ImageData`.\n\n```js\nimport { decode } from '@jsquash/gif';\n\nconst imageBuffer = await fetch('/example.gif').then((res) => res.arrayBuffer());\nconst imageData = await decode(imageBuffer);\n```\n\n### `decodeAnimated(data: ArrayBuffer): Promise<GIFFrame[]>`\n\nDecodes all GIF animation frames.\n\n```js\nimport { decodeAnimated } from '@jsquash/gif';\n\nconst imageBuffer = await fetch('/animated.gif').then((res) => res.arrayBuffer());\nconst frames = await decodeAnimated(imageBuffer);\n```\n\n### `isAnimated(data: ArrayBuffer): Promise<boolean>`\n\nChecks whether the GIF contains more than one frame.\n\n```js\nimport { isAnimated } from '@jsquash/gif';\n\nconst imageBuffer = await fetch('/image.gif').then((res) => res.arrayBuffer());\nconst animated = await isAnimated(imageBuffer);\n```\n\n## Manual WASM initialisation (not recommended)\n\nThe `decode` module exports an `init` function that can be used to manually load the wasm module.\n\n```js\nimport decode, { init as initGifDecode } from '@jsquash/gif/decode';\n\ninitGifDecode(WASM_MODULE);\nconst image = await fetch('./image.gif').then((res) => res.arrayBuffer()).then(decode);\n```\n","readmeFilename":"README.md","_rev":"1-3ee111d5d6010b43959981eb614f9cc1"}