Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    is-epubpublic

    is-epub Build Status

    Check if a Buffer/Uint8Array is EPUB

    Used by file-type.

    Install

    $ npm install --save is-epub

    Usage

    Node.js
    var readChunk = require('read-chunk'); // npm install read-chunk
    var isEpub = require('is-epub');
    var buffer = readChunk.sync('unicorn.epub', 0, 58);
     
    isEpub(buffer);
    //=> true
    Browser
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'unicorn.epub');
    xhr.responseType = 'arraybuffer';
     
    xhr.onload = function () {
        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.

    License

    MIT © Sindre Sorhus

    install

    npm i is-epub

    Downloadsweekly downloads

    84

    version

    1.0.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar