{"name":"icojs","version":"0.20.2","keywords":["ico","parse"],"author":{"name":"egy186"},"license":"MIT","_id":"icojs@0.20.2","maintainers":[{"name":"egy186","email":"egy186@gmail.com"}],"homepage":"https://egy186.github.io/icojs","bugs":{"url":"https://github.com/egy186/icojs/issues"},"dist":{"shasum":"79ddfa37a2e885319a435d884d029c3c2b3d7f16","tarball":"http://registry-npm.ywwl.com/icojs/download/icojs-0.20.2.tgz","fileCount":15,"integrity":"sha512-Zb1MGKMVcRgCAatmCAj0Z6iYpewZyLNwqefVd9WVf5qsbcnhNzbZkRU4OmtmTeNmMT0TfXURxYd4y+b93c0d7g==","signatures":[{"sig":"MEUCIQDjahXQNFwIoHsfXdiTFyeVSoSXt1UGAOrvomkgEX8RvgIgZpcIOmEuLL1MuFy79vXQam4r1Epoc7YNmfMMzPqzuwM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/icojs@0.20.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":55754,"size":16243,"noattachment":false,"key":"/icojs/-/icojs-0.20.2.tgz"},"type":"module","types":"./types/index.d.ts","browser":"./src/browser/index.js","engines":{"node":">=20.19.4"},"exports":{".":{"types":"./types/index.d.ts","default":"./src/node/index.js"},"./browser":{"types":"./types/index.d.ts","default":"./src/browser/index.js"}},"gitHead":"bd4207ece643339baa9b686f1513dac631649391","scripts":{"docs":"node scripts/docs.js","lint":"eslint","test":"npm run test:node && npm run test:browser","build":"rollup --config rollup.config.js","clean":"rimraf coverage dist docs/index.html templates/api.md README.md","jsdoc":"jsdoc2md --files \"src/**/*.js\" --heading-depth 3 --template templates/api.hbs > templates/api.md","predocs":"npm run jsdoc","pretest":"npm run build","version":"npm run docs && git add docs/index.html README.md","test:node":"c8 --reporter lcov --reporter text-summary --report-dir coverage mocha \"test/node/*.spec.js\"","test:browser":"playwright test","pretest:browser":"playwright install"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:42a02b24-781b-4a7f-a872-58728b74490e"}},"repository":{"url":"git+https://github.com/egy186/icojs.git","type":"git"},"_npmVersion":"11.11.0","description":"parse ico file","directories":{},"_nodeVersion":"24.14.1","dependencies":{"pngjs":"^7.0.0","jpeg-js":"^0.4.4","@jimp/bmp":"^0.22.12","file-type":"^21.3.4","decode-ico":"^0.4.1","to-data-view":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^11.0.0","ejs":"^5.0.1","chai":"^6.2.2","mocha":"^11.7.5","eslint":"^9.39.4","marked":"^17.0.5","rimraf":"^6.1.3","rollup":"^4.60.1","globals":"^16.4.0","jsonfile":"^6.2.0","pixelmatch":"^7.1.0","playwright":"^1.59.1","@babel/core":"^7.29.0","@playwright/test":"^1.59.1","chai-as-promised":"^8.0.2","@babel/preset-env":"^7.29.2","jsdoc-to-markdown":"^9.1.3","data-uri-to-buffer":"^8.0.0","@rollup/plugin-babel":"^7.0.0","@egy186/eslint-config":"^4.4.3","@rollup/plugin-terser":"^1.0.0","@rollup/plugin-commonjs":"^29.0.2","@rollup/plugin-node-resolve":"^16.0.3"},"_npmOperationalInternal":{"tmp":"tmp/icojs_0.20.2_1775362943555_0.4523503416362906","host":"s3://npm-registry-packages-npm-production"},"readme":"# icojs\n\n[![NPM Version](https://img.shields.io/npm/v/icojs)](https://www.npmjs.com/package/icojs)\n[![CI](https://github.com/egy186/icojs/actions/workflows/ci.yml/badge.svg)](https://github.com/egy186/icojs/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/egy186/icojs/badge.svg?branch=main)](https://coveralls.io/github/egy186/icojs?branch=main)\n\nA JavaScript library for decoding and encoding ICO files.\nWorks in both Node.js and the browser.\n\n## Install\n\n```sh\nnpm install icojs\n```\n\n```js\nimport { decodeIco, encodeIco, isIco } from 'icojs';\n```\n\nA UMD bundle is also available for browsers.\n\n```html\n<script src=\"node_modules/icojs/dist/ico.js\"></script>\n```\n\n## Demo\n\n* Decoder: [https://egy186.github.io/icojs/demo-decoder.html](https://egy186.github.io/icojs/demo-decoder.html)\n* Encoder: [https://egy186.github.io/icojs/demo-encoder.html](https://egy186.github.io/icojs/demo-encoder.html)\n\n## Example\n\n### Decoding\n\nNode.js:\n\n```js\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { decodeIco } from 'icojs';\n\nconst buffer = await readFile('favicon.ico');\nconst images = await decodeIco(buffer, 'image/png');\n// save as png files\nimages.forEach(image => {\n  const file = `${image.width}x${image.height}-${image.bpp}bit.png`;\n  const data = Buffer.from(image.buffer);\n  writeFile(file, data);\n});\n```\n\nBrowser:\n\n```html\n<input type=\"file\" id=\"input-file\" />\n<script>\n  document.querySelector('#input-file').addEventListener('change', async evt => {\n    const file = evt.target.files[0];\n    const buffer = await file.arrayBuffer();\n    const images = await ICO.decodeIco(buffer);\n    // logs images\n    console.dir(images);\n  });\n</script>\n```\n\n### Encoding\n\nNode.js:\n\n```js\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { encodeIco } from 'icojs';\n\nconst buffer1 = await readFile('16x16.png');\nconst buffer2 = await readFile('32x32.png');\nconst ico = await encodeIco([\n  { buffer: buffer1 },\n  { buffer: buffer2 }\n]);\n// save as a ico file\nwriteFile('favicon.ico', Buffer.from(ico));\n```\n\nBrowser:\n\n```html\n<input type=\"file\" id=\"input-file\" multiple />\n<script>\n  document.querySelector('#input-file').addEventListener('change', async evt => {\n    const files = Array.from(evt.target.files);\n    const iconList = await Promise.all(files.map(async file => {\n      const buffer = await file.arrayBuffer();\n      return { buffer };\n    }));\n    const ico = await ICO.encodeIco(iconList);\n    // logs ico\n    console.dir(ico);\n  });\n</script>\n```\n\n## API Documentation\n\n[https://egy186.github.io/icojs/](https://egy186.github.io/icojs/)\n","publish_time":1775362943707,"_cnpm_publish_time":1775362943707,"dist-tags":{"latest":"1.0.1"}}