{"name":"icojs","version":"0.4.0-alpha","keywords":["ico","parse"],"author":{"name":"egy186"},"license":"MIT","_id":"icojs@0.4.0-alpha","homepage":"https://egy186.github.io/icojs","bugs":{"url":"https://github.com/egy186/icojs/issues"},"dist":{"shasum":"8978008a3a7312d817afcd98007bfaa2acff4f9c","tarball":"http://registry-npm.ywwl.com/icojs/download/icojs-0.4.0-alpha.tgz","integrity":"sha512-TA73c0pRPQiSXuhFEw1VDSmvDNxyFVId1LF17Pwpjdp5LcMlVeEIOsX/hj55lq3byCiWWbSB5YUqnNajq555+w==","signatures":[{"sig":"MEYCIQDX6FMOJBhkC24iTdXmqyrenZbE82hrQm6THdi15UVALwIhAPXpGhCEBd9KB6Sw26uw9sjkPKCmIq5GMfBvAjtNtOG4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":5389,"noattachment":false,"key":"/icojs/-/icojs-0.4.0-alpha.tgz"},"main":"index.js","_from":".","files":["src","LICENSE","README.md","browser.js","index.js","package.json"],"_shasum":"8978008a3a7312d817afcd98007bfaa2acff4f9c","engines":{"node":">=4.2.3"},"gitHead":"296b146e4a5fa35a09b839f48a0bece66d5a4eee","scripts":{"doc":"jsdoc2md -f src/ico.js -t templates/README.md > README.md","lint":"eslint src test","test":"istanbul cover --root src --report lcov --dir coverage node_modules/mocha/bin/_mocha -- test/*.js","build":"mkdirp dist && browserify src/browser/index.js --debug --plugin [ minifyify --map ico.js.map --output dist/ico.js.map ] --transform babelify --standalone ICO --outfile dist/ico.js","clean":"rimraf coverage dist"},"_npmUser":{"name":"egy186","email":"egy186@yahoo.co.jp"},"repository":{"url":"git+https://github.com/egy186/icojs.git","type":"git"},"_npmVersion":"3.3.12","description":"parse ico file","directories":{},"_nodeVersion":"5.3.0","dependencies":{"jimp":"^0.2.21"},"devDependencies":{"chai":"^3.0.0","mocha":"^2.3.4","eslint":"^1.10.3","mkdirp":"^0.5.1","rimraf":"^2.4.4","babelify":"^7.2.0","istanbul":"^0.4.1","minifyify":"^7.1.0","browserify":"^12.0.1","chai-as-promised":"^5.1.0","jsdoc-to-markdown":"^1.3.1","babel-preset-es2015":"^6.3.13","eslint-config-eslint":"^1.0.1"},"readme":"# icojs\n\n[![npm](https://img.shields.io/npm/v/icojs.svg)](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[![codebeat badge](https://codebeat.co/badges/85bd457f-39b6-43d8-bf8e-c80ace07a8d7)](https://codebeat.co/projects/github-com-egy186-icojs)\n\nA JavaScript library to use ICO.\nWorks on both Node.js and the browser.\n\n## Install\n\n```sh\nnpm install icojs\n```\n\n### Node.js:\n\n```js\nimport { isICO, parseICO } from 'icojs';\n```\n\n### Browser:\n\n```js\nimport { isICO, parseICO } from 'icojs/browser';\n```\n\nor\n\n```html\n<script type=\"text/javascript\" src=\"node_modules/icojs/dist/ico.js\"></script>\n```\n\nTo fully use this library, browsers must support **JavaScript typed arrays**, **Canvas API** and **Promise**.\nChrome, Edge 12, Firefox and Safari 9 support these functions.\n\n## Example\n\n### Node.js:\n\n```js\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { parseICO } from 'icojs';\n\nconst buffer = await readFile('favicon.ico');\nconst images = await parseICO(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\n### Browser:\n\n```html\n<input type=\"file\" id=\"input-file\" />\n<script>\n  document.getElementById('input-file').addEventListener('change', evt => {\n    // use FileReader for converting File object to ArrayBuffer object\n    var reader = new FileReader();\n    reader.onload = async e => {\n      const images = await ICO.parseICO(e.target.result);\n      // logs images\n      console.dir(images);\n    };\n    reader.readAsArrayBuffer(evt.target.files[0]);\n  }, false);\n</script>\n```\n\n## Demo\n\n[https://egy186.github.io/icojs/#demo](https://egy186.github.io/icojs/#demo)\n\n## API\n\n<a name=\"module_ICO\"></a>\n\n### ICO\n\n* [ICO](#module_ICO)\n    * [isICO(source)](#exp_module_ICO--isICO) ⇒ <code>boolean</code> ⏏\n    * [parseICO(buffer, [mime])](#exp_module_ICO--parseICO) ⇒ <code>Promise.&lt;Array.&lt;ParsedImage&gt;&gt;</code> ⏏\n\n<a name=\"exp_module_ICO--isICO\"></a>\n\n#### isICO(source) ⇒ <code>boolean</code> ⏏\nCheck the ArrayBuffer is valid ICO.\n\n**Kind**: global method of [<code>ICO</code>](#module_ICO)  \n**Returns**: <code>boolean</code> - True if arg is ICO.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| source | <code>ArrayBuffer</code> \\| <code>Buffer</code> | ICO file data. |\n\n<a name=\"exp_module_ICO--parseICO\"></a>\n\n#### parseICO(buffer, [mime]) ⇒ <code>Promise.&lt;Array.&lt;ParsedImage&gt;&gt;</code> ⏏\nParse ICO and return some images.\n\n**Kind**: global method of [<code>ICO</code>](#module_ICO)  \n**Returns**: <code>Promise.&lt;Array.&lt;ParsedImage&gt;&gt;</code> - Resolves to an array of [ParsedImage](#ParsedImage).  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| buffer | <code>ArrayBuffer</code> \\| <code>Buffer</code> |  | ICO file data. |\n| [mime] | <code>string</code> | <code>&quot;image/png&quot;</code> | MIME type for output. |\n\n\n## Typedefs\n\n<a name=\"ParsedImage\"></a>\n\n### ParsedImage : <code>object</code>\n**Kind**: global typedef  \n**Properties**\n\n| Name | Type | Description |\n| --- | --- | --- |\n| width | <code>number</code> | Image width. |\n| height | <code>number</code> | Image height. |\n| bpp | <code>number</code> | Image color depth as bits per pixel. |\n| buffer | <code>ArrayBuffer</code> | Image buffer. |\n\n\n## License\n\nMIT license\n","publish_time":1451380468801,"maintainers":[{"name":"egy186","email":"egy186@yahoo.co.jp"}],"_cnpm_publish_time":1451380468801,"dist-tags":{"latest":"1.0.1"}}