Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-7z

t1st313MIT2.0.0

Check if a Buffer/Uint8Array is a 7Z archive

7z, 7-zip, archive, type, detect, check, is, binary, buffer, uint8array

readme

is-7z

NPM version Build Status

Check if a Buffer/Uint8Array is a 7Z archive.

Install

$ npm install --save is-7z

Usage

Node.js

var readChunk = require('read-chunk'); // npm install read-chunk
var is7z = require('is-7z');
var buffer = readChunk.sync('unicorn.7z', 0, 6);

is7z(buffer);
//=> true

Browser

var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.7z');
xhr.responseType = 'arraybuffer';

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

xhr.send();

API

is7z(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 6 bytes.

License

MIT © t1st3