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

    is-tifpublic

    is-tif Build Status

    Check if a Buffer/Uint8Array is a TIFF image

    Used by image-type.

    Install

    $ npm install --save is-tif

    Usage

    Node.js
    var readChunk = require('read-chunk'); // npm install read-chunk
    var isTif = require('is-tif');
    var buffer = readChunk.sync('unicorn.tif', 0, 4);
     
    isTif(buffer);
    //=> true
    Browser
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'unicorn.tif');
    xhr.responseType = 'arraybuffer';
     
    xhr.onload = function () {
        isTif(new Uint8Array(this.response));
        //=> true
    };
     
    xhr.send();

    API

    isTif(buffer)

    Accepts a Buffer (Node.js) or Uint8Array.

    It only needs the first 4 bytes.

    License

    MIT © Sindre Sorhus

    install

    npm i is-tif

    Downloadslast 7 days

    1,721

    version

    1.0.1

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar