is-xcf

0.0.8 • Public • Published

is-xcf Build Status

Check if a Buffer/Uint8Array is an XCF image

Inspired by sindresorhus and his wonderful repos like is-gif.

Install

npm install --save is-xcf
bower install --save is-xcf

Usage

Node.js
var fs = require('fs');
var isXCF = require('is-xcf');
var buffer = fs.readFileSync('awesome.xcf');
 
isXCF(buffer); // returns true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'awesome.xcf');
xhr.responseType = 'arraybuffer';
 
xhr.onload = function () {
  isXCF(new Uint8Array(this.response)); // returns true
};
 
xhr.send();

API

isXCF(buffer)

Accepts a Buffer or Unit8Array.

Only needs the first 8 bytes, more is fine though.

License

This module is ISC licensed.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i is-xcf

    Weekly Downloads

    0

    Version

    0.0.8

    License

    ISC

    Last publish

    Collaborators

    • pskupinski