A JavaScript library to use ICO. Work on both Node.js and Browser.
const fs = require('fs');
const ICO = require('icojs');
const arrayBuffer = new Uint8Array(fs.readFileSync('favicon.ico')).buffer;
ICO.parse(arrayBuffer).then(images => {
// do something
});
npm install icojs
bower install icojs
And add to HTML:
<script type="text/javascript" src="/path/to/ico.js"></script>
To fully use this library, browsers must support JavaScript typed arrays, Canvas API and Promise. Chrome, Edge 12, Firefox and Safari 9 support these functions.
https://egy186.github.io/icojs/#demo
- ICO
- .parse(buffer, mime) ⇒
Promise.<Array.<Object>>
- .isICO(buffer) ⇒
Boolean
- .noConflict() ⇒
ICO
- .parse(buffer, mime) ⇒
Parse ICO and return some PNGs.
Kind: static method of ICO
Returns: Promise.<Array.<Object>>
- Resolves to array of parsed ICO.
width
Number - Image width.height
Number - Image height.bit
Number - Image bit depth.buffer
ArrayBuffer - Image buffer.
Param | Type | Description |
---|---|---|
buffer | ArrayBuffer |
The ArrayBuffer object contain the TypedArray of a ICO file. |
mime | String |
Mime type for output. |
Check the ArrayBuffer is valid ICO.
Kind: static method of ICO
Returns: Boolean
- True if arg is ICO.
Param | Type | Description |
---|---|---|
buffer | ArrayBuffer |
The ArrayBuffer object contain the TypedArray of a ICO file. |
ICO.noConflict() ⇒ ICO
No conflict.
Kind: static method of ICO
Returns: ICO
- ICO
Object.
MIT license