Skip to content

oaleynik/is-heic

Repository files navigation

is-heic Build Status

Check if a Buffer/Uint8Array is a HEIC image (inspired by is-jpg)

Install

$ npm install --save is-heic

Usage

Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isHeic = require('is-heic');
var buffer = readChunk.sync('unicorn.heic', 0, 24);

isHeic(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.heic');
xhr.responseType = 'arraybuffer';

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

xhr.send();

API

isHeic(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 24 bytes.

License

MIT © Oleh Aleinyk

About

Check if a Buffer/Uint8Array is a HEIC image

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published