{"_id":"@jsquash/jxl","_rev":"8-b23d8b1c251af7c977d59487fa6cddee","name":"@jsquash/jxl","dist-tags":{"single-thread-only":"1.0.2-single-thread-only","latest":"1.3.0"},"versions":{"1.0.0":{"name":"@jsquash/jxl","version":"1.0.0","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.0.0","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"9e922d071479a2134f4c39bf2b35cb800c124230","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.0.0.tgz","fileCount":35,"integrity":"sha512-jfeN/mYUHIfuw29f1RZNwaIT7VizIYN9KlPBfgQyXZ0NFG6MgLPmT0Twr+IUFCpe1FbYNhc1Xswx0MkwccEcbw==","signatures":[{"sig":"MEUCIQDnGscXGj2zQlJJEjrpcWk7iM+cSxyr4UrgfVqPHFiIfQIgOZ/A5U/KRXiYqG+Yi4yJ0xTyKCFQJ3Ib/Ntn0BKHYLg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5852783},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"f76973eaec7803b79738c3a9cece15489e6a721e","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"9.6.4","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.0.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.0.0_1686673108665_0.8307488061173878","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@jsquash/jxl","version":"1.0.1","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.0.1","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"2f1c615f7902d8d4a159cbf5a95d82aa9e0dfe73","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.0.1.tgz","fileCount":35,"integrity":"sha512-l/US7TVdUrhOlYCEsDpKma7mpT8SqOTdGT1RUQ1rJTvK7eBpGOGeXPd1IOU95QnBtkz4uTT3qNcarDGAsGqxhQ==","signatures":[{"sig":"MEUCIQCvtu8n/z2t+iLq6QQ3aYN+JJuRKk1pZSbUH3k+0hO6xAIgMPfI3D+mDdbOm40aLxBPGkazvz1HudQ4qQ3ucGQsS5s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5851801},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"7b7dc50e2ef178ddcc92fd22a56df939798548df","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"9.6.4","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.0.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.0.1_1686750341485_0.1123773470994911","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@jsquash/jxl","version":"1.0.2","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.0.2","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"a5b70baee1dbba22396e7fb47150c53740ef7946","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.0.2.tgz","fileCount":35,"integrity":"sha512-KshUdiFrntl0RDzyTfpoQO2XkZZYoaTvYCcLV+HrycnNdbqIOulgI9J88u4kSic0zxUoqEiSdWD3g0/DhCEFQw==","signatures":[{"sig":"MEYCIQCkZfuBXShNmQZGhjRYnOz49f0XTSUf4bUJ3I+GrtVbewIhAMMjukTz/d1pTmghXIhCGiOmQZlOGYdCaJSydd7uYjki","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5851780},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"c8b3b4dcb137dcd3d98aa4ea618a9a5ec6c0f9eb","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"9.6.4","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.0.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.0.2_1686752654427_0.932403985662386","host":"s3://npm-registry-packages"}},"1.0.2-single-thread-only":{"name":"@jsquash/jxl","version":"1.0.2-single-thread-only","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.0.2-single-thread-only","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"ec353132e36d274322a181040e0b6116de413e16","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.0.2-single-thread-only.tgz","fileCount":27,"integrity":"sha512-zjgmhVkllq9tfSCwfhnpUbpMC2Oj2GicWR7TH0/ISmjsF1Jw6P8jEOOR+tLTKr6W6HrxFOc3hTWj5e54WKKPqw==","signatures":[{"sig":"MEUCIHj1uMHIZ2eprMMInSTQK2wQ4enV6hXZt6Pv3YqUW16HAiEA3tt1/91F/gM/SXmwdecto/6CLJuq6A9M856dKzEYdM8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2333294},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"3d4001843fd41e60eceb4b006dbe79b50f95ca7f","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"9.6.4","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.0.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"typescript":"^4.4.4"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.0.2-single-thread-only_1692521774129_0.039641257955374876","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@jsquash/jxl","version":"1.0.3","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.0.3","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"58a36c4827f2ca5832b361e3fb03ca11a5da4e57","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.0.3.tgz","fileCount":35,"integrity":"sha512-oMoN8xaCdBMRC1FN76E7BKwsGnO+cDRprVVVd3TAxwHwuF+wd1krzsFPyqc9Hxaop5bArCeYlaxvGgUj+dr8Zw==","signatures":[{"sig":"MEUCIB5Wbs+TqjyoZjs6vSMRRV7LM/gBVEKF/2N8RTsB1DfQAiEAkTV8DU/gIB8dZ2GUmDT9sQmhx71oG2gLr3MiZ8ci7tA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5851945},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"d37f2a782d881c7de8287bba4d3f725a645c556c","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"8.19.2","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"18.12.1","dependencies":{"wasm-feature-detect":"^1.5.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.0.3_1692525352898_0.22706262540121647","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@jsquash/jxl","version":"1.1.0","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.1.0","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"9e0fc5e7b0ba91bccb30f49b88574893abd9cec4","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.1.0.tgz","fileCount":30,"integrity":"sha512-atdg3ZOOhmK3A87gRRS1mTBp+ljVK0rYaAVAhnrv7GhKTPFDZKo+GkLsXMu5oAka43Wi9iBOXFJeq+xtD1z57w==","signatures":[{"sig":"MEYCIQDwWdrUXOpP8oBqTdpJWpPayHJxx+kB0rHR+fJKMRUfawIhAJTKHUDduG4od93dDVVV6MqDPrTNqLFE7TliW9qWzdz/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5874835},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"93991a37796f84cc17e7202f4878cc1fb3995659","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md LICENSE *.d.ts .npmignore dist","clean":"rm -rf dist","build:codec":"cd codec && npm run build","prepublishOnly":"[[ \"$PWD\" == *'/dist' ]] && exit 0 || (echo 'Please run npm publish from the dist directory' && exit 1)"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"10.1.0","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.8.1","dependencies":{"wasm-feature-detect":"^1.5.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4","@types/node":"^20.9.2"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.1.0_1700475813982_0.8258381527546406","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@jsquash/jxl","version":"1.2.0","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","_id":"@jsquash/jxl@1.2.0","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"homepage":"https://github.com/jamsinclair/jSquash#readme","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"dist":{"shasum":"90639ce827d6b007b3c404181e76b42754341ff5","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.2.0.tgz","fileCount":30,"integrity":"sha512-lHbhlTabNjCQCkREzLhSzT3NPySclkwtZmhRYZY9VA7WDGfpaXUULjkbOHlPy6A8QJcCYgelB9LEzSJ4G1qx9w==","signatures":[{"sig":"MEQCIG8JuzyK5BGyRqfrpDRTTZDjP76FfXv3gpOwQiV4TEJOAiAgs2TkJzrKo8H+VPfhhD+bRof32Gq1d7NpH1RlcDGI5w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5846973},"main":"index.js","type":"module","types":"./index.d.ts","gitHead":"a66511288129b02f1554226f203f9fec25a8d72d","scripts":{"build":"npm run clean && tsc && cp -r codec package.json README.md CHANGELOG.md *.d.ts .npmignore ../../LICENSE dist","clean":"rm -rf dist","build:codec":"cd codec && npm run build","prepublishOnly":"[[ \"$PWD\" == *'/dist' ]] && exit 0 || (echo 'Please run npm publish from the dist directory' && exit 1)"},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"repository":{"url":"git+https://github.com/jamsinclair/jSquash.git","type":"git"},"_npmVersion":"10.5.0","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","directories":{},"sideEffects":false,"_nodeVersion":"20.12.0","dependencies":{"wasm-feature-detect":"^1.5.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.4.4","@types/node":"^20.9.2"},"_npmOperationalInternal":{"tmp":"tmp/jxl_1.2.0_1747062242101_0.7890412083401497","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@jsquash/jxl","version":"1.3.0","main":"index.js","description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","repository":{"type":"git","url":"git+https://github.com/jamsinclair/jSquash.git"},"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"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 CHANGELOG.md *.d.ts .npmignore ../../LICENSE dist","prepublishOnly":"[[ \"$PWD\" == *'/dist' ]] && exit 0 || (echo 'Please run npm publish from the dist directory' && exit 1)"},"dependencies":{"wasm-feature-detect":"^1.5.1"},"devDependencies":{"@types/node":"^20.9.2","typescript":"^4.4.4"},"type":"module","sideEffects":false,"_id":"@jsquash/jxl@1.3.0","gitHead":"1b1964194611ece3ec984ab91c04726d1088f05e","types":"./index.d.ts","bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"homepage":"https://github.com/jamsinclair/jSquash#readme","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-IVOPTneyOd9eBAuow+FnCYIP6wkIc7CjrCDnZGiqAPyJ63vMVxv3zoWiucGiZVh6u9vi/l40AkcS9QwkoVSAqA==","shasum":"2fc3e5be528dc9b81fec189eb75ad85400cfbde9","tarball":"https://registry.npmjs.org/@jsquash/jxl/-/jxl-1.3.0.tgz","fileCount":30,"unpackedSize":5848914,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBHH40Pv56VGzW5Xd95BPCUyutEqpqVS4xNg+8bG9udeAiEAv/4qW/m/1GTGX/KI6InLzIwu8NyABeVjuyKEbxcN1YQ="}]},"_npmUser":{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"},"directories":{},"maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jxl_1.3.0_1752288679625_0.4778943569042935"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-13T16:18:28.605Z","modified":"2025-07-12T02:51:20.033Z","1.0.0":"2023-06-13T16:18:28.948Z","1.0.1":"2023-06-14T13:45:41.736Z","1.0.2":"2023-06-14T14:24:14.719Z","1.0.2-single-thread-only":"2023-08-20T08:56:14.398Z","1.0.3":"2023-08-20T09:55:53.205Z","1.1.0":"2023-11-20T10:23:34.303Z","1.2.0":"2025-05-12T15:04:02.340Z","1.3.0":"2025-07-12T02:51:19.844Z"},"bugs":{"url":"https://github.com/jamsinclair/jSquash/issues"},"author":{"name":"Jamie Sinclair","email":"jamsinclairnz+npm@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/jamsinclair/jSquash#readme","keywords":["image","optimisation","optimization","squoosh","wasm","webassembly","jpegxl","jpeg xl","jxl"],"repository":{"type":"git","url":"git+https://github.com/jamsinclair/jSquash.git"},"description":"Wasm JPEG XL encoder and decoder supporting the browser. Repackaged from Squoosh App.","maintainers":[{"name":"jamsinclair","email":"jamsinclairnz+npm@gmail.com"}],"readme":"# @jsquash/jxl\n\n[![npm version](https://badge.fury.io/js/@jsquash%2Fjxl.svg)](https://badge.fury.io/js/@jsquash%2Fjxl)\n\nAn easy experience for encoding and decoding JPEG XL images in the browser. Powered by WebAssembly ⚡️.\n\n⚠️ Only one stable browser supports displaying JPEG XL [so far](https://caniuse.com/jpegxl). This package is intended for experimentation and testing.\n\nUses the [libjxl](https://github.com/libjxl/libjxl) library.\n\nA [jSquash](https://github.com/jamsinclair/jSquash) package. Codecs and supporting code derived from the [Squoosh](https://github.com/GoogleChromeLabs/squoosh) app.\n\n## Installation\n\n```shell\nnpm install --save @jsquash/jxl\n# Or your favourite package manager alternative\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 JPEG XL binary ArrayBuffer to raw RGB image data.\n\n#### data\nType: `ArrayBuffer`\n\n#### Example\n```js\nimport { decode } from '@jsquash/jxl';\n\nconst formEl = document.querySelector('form');\nconst formData = new FormData(formEl);\n// Assuming user selected an input JPEG XL file\nconst imageData = await decode(await formData.get('image').arrayBuffer());\n```\n\n### encode(data: ImageData, options?: EncodeOptions): Promise<ArrayBuffer>\n\nEncodes raw RGB image data to JPEG format and resolves to an ArrayBuffer of binary data.\n\n#### data\nType: `ImageData`\n\n#### options\nType: `Partial<EncodeOptions>`\n\nThe JPEG XL encoder options for the output image. [See default values](./meta.ts).\n\n#### Example\n```js\nimport { encode } from '@jsquash/jxl';\n\nasync function loadImage(src) {\n  const img = document.createElement('img');\n  img.src = src;\n  await new Promise(resolve => img.onload = resolve);\n  const canvas = document.createElement('canvas');\n  [canvas.width, canvas.height] = [img.width, img.height];\n  const ctx = canvas.getContext('2d');\n  ctx.drawImage(img, 0, 0);\n  return ctx.getImageData(0, 0, img.width, img.height);\n}\n\nconst rawImageData = await loadImage('/example.png');\nconst jpegBuffer = await encode(rawImageData);\n```\n\n#### Lossless Example\n```js\nimport { encode } from '@jsquash/jxl';\n\nconst rawImageData = await loadImage('/example.png');\n// Lossless encoding can be achieved by setting the `lossless` option to `true`\nconst jxlBuffer = await encode(rawImageData, { lossless: true });\n```\n\n## Activate Multithreading\n\nBy default, the encode function will use a single thread to encode the image. If you want to speed this up you can enable multithreading with the following.\n\n1. Move your calls to `encode` into a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers).\n1. Configure your web server to use the following headers (this is [a security requirement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements))\n    - `Cross-Origin-Opener-Policy: same-origin`\n    - `Cross-Origin-Embedder-Policy: require-corp`\n\nThis will still only take effect in browsers and devices that support multithreading. If the browser does not support it, it will fallback to single threaded mode\n\n## Manual WASM initialisation (not recommended)\n\nIn most situations there is no need to manually initialise the provided WebAssembly modules.\nThe generated glue code takes care of this and supports most web bundlers.\n\nOne situation where this arises is when using the modules in Cloudflare Workers ([See the README for more info](/README.md#usage-in-cloudflare-workers)).\n\nThe `encode` and `decode` modules both export an `init` function that can be used to manually load the wasm module.\n\n```js\nimport decode, { init as initJXLDecode } from '@jsquash/jxl/decode';\n\ninitJXLDecode(WASM_MODULE); // The `WASM_MODULE` variable will need to be sourced by yourself and passed as an ArrayBuffer.\nconst image = await fetch('./image.jpeg').then(res => res.arrayBuffer()).then(decode);\n```\n\nYou can also pass custom options to the `init` function to customise the behaviour of the module. See the [Emscripten documentation](https://emscripten.org/docs/api_reference/module.html#Module) for more information.\n\n```js\nimport decode, { init as initJXLDecode } from '@jsquash/jxl/decode';\n\ninitJXLDecode(null, {\n  // Customise the path to load the wasm file\n  locateFile: (path, prefix) => `https://example.com/${prefix}/${path}`,\n});\nconst image = await fetch('./image.jxl').then(res => res.arrayBuffer()).then(decode);\n```\n\n## Known Issues\n\nSee [jSquash Project README](https://github.com/jamsinclair/jSquash#known-issues)\n","readmeFilename":"README.md"}