<commit_before># icojs

[![Bower version](https://img.shields.io/bower/v/icojs.svg?style=flat)](https://github.com/egy186/icojs)

[![Build Status](https://img.shields.io/travis/egy186/icojs.svg?style=flat)](https://travis-ci.org/egy186/icojs)
[![Coverage Status](https://img.shields.io/coveralls/egy186/icojs.svg?style=flat)](https://coveralls.io/r/egy186/icojs)
[![Code Climate](https://img.shields.io/codeclimate/github/egy186/icojs.svg?style=flat)](https://codeclimate.com/github/egy186/icojs)
[![Dependency Status](https://img.shields.io/david/egy186/icojs.svg?style=flat)](https://david-dm.org/egy186/icojs)

**icojs** is a JavaScript library to use `ICO`.

Work on both Node.js and Browser.

## Example

```js
var fs = require('fs');
var ICO = require('icojs');

var arrayBuffer = new Uint8Array(fs.readFileSync('favicon.ico')).buffer;
var images = ICO.parse(arrayBuffer);
```

## Install

### In Node.js

```sh
npm install icojs
```

### In Browser

```sh
bower install icojs
```

Add below to HTML:

```html
<script type="text/javascript" src="/path/to/ico.js"></script>
```

To fully use this library, browsers must support **JavaScript typed arrays** and some Web API Interfaces below:

- Canvas
- Blob (optional)
- FileReader (optional)
- XMLHttpRequest (optional)

Google Chrome, Internet Explorer 10, Mozilla Firefox and Safari 6 support these function.

## Demo

[http://egy186.github.io/icojs/#demos](http://egy186.github.io/icojs/#demos)

## Documentation

### ICO.parse(buffer)

Parse `ICO` and return some `PNG`(s).

#### Parameters

- `buffer` **ArrayBuffer** The ArrayBuffer object contain the TypedArray of a `ICO` file.

#### Returns

- `images` **Object[]** PNG images.
- `images[].width` **Number** Image width.
- `images[].height` **Number** Image height.
- `images[].bit` **Number** Image bit depth.
- `images[].buffer` **ArrayBuffer** Image buffer.

### ICO.isICO(buffer)

Check the ArrayBuffer is valid `ICO`.

#### Parameters

- `buffer` **ArrayBuffer** The ArrayBuffer object contain the TypedArray of a `ICO` file.

#### Returns

- `isICO` **Boolean** True if arg is `ICO`.

## License

MIT license<commit_msg>update support browser version<commit_after># icojs

[![Bower version](https://img.shields.io/bower/v/icojs.svg?style=flat)](https://github.com/egy186/icojs)

[![Build Status](https://img.shields.io/travis/egy186/icojs.svg?style=flat)](https://travis-ci.org/egy186/icojs)
[![Coverage Status](https://img.shields.io/coveralls/egy186/icojs.svg?style=flat)](https://coveralls.io/r/egy186/icojs)
[![Code Climate](https://img.shields.io/codeclimate/github/egy186/icojs.svg?style=flat)](https://codeclimate.com/github/egy186/icojs)
[![Dependency Status](https://img.shields.io/david/egy186/icojs.svg?style=flat)](https://david-dm.org/egy186/icojs)

A JavaScript library to use ICO.

Work on both Node.js and Browser.

```js
var fs = require('fs');
var ICO = require('icojs');

var arrayBuffer = new Uint8Array(fs.readFileSync('favicon.ico')).buffer;
var images = ICO.parse(arrayBuffer);
```

## Install

### Node.js:

```sh
npm install icojs
```

### Browser:

```sh
bower install icojs
```

And add to HTML:

```html
<script type="text/javascript" src="/path/to/ico.js"></script>
```

To fully use this library, browsers must support **JavaScript typed arrays** and **Canvas API**.

Google Chrome, Internet Explorer 11, Mozilla Firefox and Safari 7.1 support these functions.

## Demo

[http://egy186.github.io/icojs/#demos](http://egy186.github.io/icojs/#demos)

## Documentation

### ICO.parse(buffer)

Parse ICO and return some PNG(s).

#### Parameters

- `buffer` **ArrayBuffer** The ArrayBuffer object contain the TypedArray of a ICO file.

#### Returns

- `images` **Object[]** Array of PNG images.
- `images[].width` **Number** Image width.
- `images[].height` **Number** Image height.
- `images[].bit` **Number** Image bit depth.
- `images[].buffer` **ArrayBuffer** Image buffer.

### ICO.isICO(buffer)

Check the ArrayBuffer is valid ICO.

#### Parameters

- `buffer` **ArrayBuffer** The ArrayBuffer object contain the TypedArray of a ICO file.

#### Returns

- `isICO` **Boolean** True if arg is ICO.

## License

MIT license
{'fraction_non_alphanumeric': 0.18388875569407817, 'fraction_numerical': 0.017981299448573483, 'mean_word_length': 4.8431372549019605, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5542281', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1438, 'n_words': 339}