<commit_before># is-webp [![Build Status](https://travis-ci.org/sindresorhus/is-webp.svg?branch=master)](https://travis-ci.org/sindresorhus/is-webp)

> Check if a Buffer/Uint8Array is a [WebP](https://en.wikipedia.org/wiki/WebP) image


## Install

```
$ npm install is-webp
```


## Usage

##### Node.js

```js
const readChunk = require('read-chunk');
const isWebp = require('is-webp');
const buffer = readChunk.sync('unicorn.webp', 0, 12);

isWebp(buffer);
//=> true
```

##### Browser

```js
const xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.webp');
xhr.responseType = 'arraybuffer';

xhr.onload = () => {
	isWebp(new Uint8Array(this.response));
	//=> true
};

xhr.send();
```


## API

### isWebp(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 12 bytes.


## Related

- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array


## License

MIT © [<NAME>](https://sindresorhus.com)<commit_msg>Add related project to the readme (#3)<commit_after># is-webp [![Build Status](https://travis-ci.org/sindresorhus/is-webp.svg?branch=master)](https://travis-ci.org/sindresorhus/is-webp)

> Check if a Buffer/Uint8Array is a [WebP](https://en.wikipedia.org/wiki/WebP) image


## Install

```
$ npm install is-webp
```


## Usage

##### Node.js

```js
const readChunk = require('read-chunk');
const isWebp = require('is-webp');
const buffer = readChunk.sync('unicorn.webp', 0, 12);

isWebp(buffer);
//=> true
```

##### Browser

```js
const xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.webp');
xhr.responseType = 'arraybuffer';

xhr.onload = () => {
	isWebp(new Uint8Array(this.response));
	//=> true
};

xhr.send();
```


## API

### isWebp(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 12 bytes.


## Related

- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array
- [is-webp-extended](https://github.com/mooyoul/is-webp-extended) - Extended version of this package which supports checking for animated WebP


## License

MIT © [<NAME>](https://sindresorhus.com)
{'fraction_non_alphanumeric': 0.19332079021636878, 'fraction_numerical': 0.008936970837253057, 'mean_word_length': 4.344221105527638, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 11, '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': '3765252', 'n_tokens_mistral': 844, 'n_tokens_neox': 795, 'n_words': 167}