@cjser/is-jxr
v2.0.0-cjser.2
Published
Check if a Buffer/Uint8Array is a JPEG XR image
Maintainers
Readme
is-jxr
Check if a Buffer/Uint8Array is a JPEG XR image
Install
npm install is-jxrUsage
Node.js
import {readChunk} from 'read-chunk';
import isJxr from 'is-jxr';
const buffer = await readChunk('unicorn.jxr', {length: 3});
isJxr(buffer);
//=> trueBrowser
const xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.jxr');
xhr.responseType = 'arraybuffer';
xhr.onload = () => {
isJxr(new Uint8Array(this.response));
//=> true
};
xhr.send();API
isJxr(buffer)
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 3 bytes.
Related
- file-type - Detect the file type of a Buffer/Uint8Array
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/is-jxr
