JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2451265
  • Score
    100M100P100Q233567F
  • License MIT

Detect the archive type of a Buffer/Uint8Array

Package Exports

  • archive-type

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (archive-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

archive-type Build Status

Detect the archive type of a Buffer/Uint8Array

Install

$ npm install --save archive-type

Usage

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

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

API

archiveType(buf)

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

buf

Type: buffer (Node.js), uint8array

It only needs the first 261 bytes.

CLI

$ npm install --global archive-type
$ archive-type --help

  Usage
    $ archive-type <file>
    $ cat <file> | archive-type

  Example
    $ archive-type foo.tar.gz
    $ cat foo.tar.gz | archive-type

License

MIT © Kevin Mårtensson