is-tif
Check if a Buffer/Uint8Array is a TIFF image
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-tif 
SYNC missed versions from official npm registry.

is-tif

Check if a Buffer/Uint8Array is a TIFF image

Install

$ npm install is-tif

Usage

Node.js
import {readChunkSync} from 'read-chunk';
import isTif from 'is-tif';

const buffer = readChunkSync('unicorn.tif', {length: 4});

isTif(buffer);
//=> true
Browser
const xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.tif');
xhr.responseType = 'arraybuffer';

xhr.onload = () => {
	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.

Related

  • file-type - Detect the file type of a Buffer/Uint8Array

Current Tags

  • 2.0.0                                ...           latest (5 years ago)

5 Versions

  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |