archive-type
Detect the archive type of a Buffer/Uint8Array
Last updated 9 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install archive-type 
SYNC missed versions from official npm registry.

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

Current Tags

  • 4.0.0                                ...           latest (9 years ago)

18 Versions

  • 4.0.0                                ...           9 years ago
  • 3.2.0                                ...           10 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.2                                ...           10 years ago
  • 3.0.1                                ...           11 years ago
  • 3.0.0                                ...           11 years ago
  • 2.1.0                                ...           11 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.4                                ...           11 years ago
  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.4                                ...           12 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (2)
Downloads
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)

Copyright 2013 - present © cnpmjs.org | Home |