backoffice/node_modules/archive-type
root ab9f8bb658 first commit 2020-02-06 10:09:39 +00:00
..
index.js first commit 2020-02-06 10:09:39 +00:00
license first commit 2020-02-06 10:09:39 +00:00
package.json first commit 2020-02-06 10:09:39 +00:00
readme.md first commit 2020-02-06 10:09:39 +00:00

readme.md

archive-type Build Status

Detect the archive type of a Buffer/Uint8Array

See archive-type-cli for the command-line version.

Install

$ npm install --save archive-type

Usage

var readFileSync = require('fs').readFileSync;
var archiveType = require('archive-type');

archiveType(readFileSync('foo.zip'));
//=> {ext: 'zip', mime: 'application/zip'}

API

archiveType(buf)

Returns 7z, bz2, gz, rar, tar, zip, xz or false.

buf

Type: buffer (Node.js), uint8array

It only needs the first 261 bytes.

License

MIT © Kevin Mårtensson