# is-epub

> Check if a Buffer/Uint8Array is EPUB

Latest version **2.0.0** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-epub
pnpm add is-epub
yarn add is-epub
bun add is-epub
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-05-03 |
| First published | 2014-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | epub, ebook, book, type, detect, check, is, binary, buffer, uint8array |

## Links

- npm: https://www.npmjs.com/package/is-epub
- Repository: https://github.com/sindresorhus/is-epub
- Homepage: https://github.com/sindresorhus/is-epub#readme
- Issues: https://github.com/sindresorhus/is-epub/issues
- npm.io page: https://npm.io/package/is-epub

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-05-03
- 1.0.1 — 2018-03-22
- 1.0.0 — 2014-08-14
- 0.1.2 — 2014-04-29
- 0.1.1 — 2014-04-26
- 0.1.0 — 2014-04-26

## README

# is-epub

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

## Install

```
$ npm install is-epub
```

## Usage

##### Node.js

```js
import readChunk from 'read-chunk';
import isEpub from 'is-epub';

const buffer = readChunk.sync('unicorn.epub', 0, 58);

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

##### Browser

```js
import isEpub from 'is-epub';

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

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

xhr.send();
```

## API

### isEpub(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 58 bytes.

## Related

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

---
_Source: https://npm.io/package/is-epub · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
