archive-type

4.0.0 • Public • Published

archive-type Build Status

Detect the archive type of a Buffer/Uint8Array

Install

$ npm install --save archive-type

Usage

const archiveType = require('archive-type');
const readChunk = require('read-chunk');
const buffer = readChunk.sync('unicorn.zip', 0, 262);
 
archiveType(buffer);
//=> {ext: 'zip', mime: 'application/zip'}

API

archiveType(input)

Returns an Object with:

Or null when no match.

input

Type: Buffer Uint8Array

It only needs the first 262 bytes.

Supported file types

  • 7z
  • bz2
  • gz
  • rar
  • tar
  • zip
  • xz
  • gz

Related

License

MIT © Kevin Mårtensson

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.0.01,582,645latest

Version History

VersionDownloads (Last 7 Days)Published
4.0.01,582,645
3.2.058,214
3.1.00
3.0.23
3.0.10
3.0.01
2.1.0324
2.0.01
1.0.4274
1.0.30
1.0.24
1.0.10
1.0.00
0.1.413
0.1.30
0.1.21
0.1.10
0.1.00

Package Sidebar

Install

npm i archive-type

Weekly Downloads

350,843

Version

4.0.0

License

MIT

Last publish

Collaborators

  • kevva
  • sindresorhus