ghaction-upx/node_modules/archive-type
2020-01-17 09:39:25 +01:00
..
node_modules/file-type Update node_modules 2020-01-17 09:39:25 +01:00
index.js Update node_modules 2020-01-17 09:39:25 +01:00
license Update node_modules 2020-01-17 09:39:25 +01:00
package.json Update node_modules 2020-01-17 09:39:25 +01:00
readme.md Update node_modules 2020-01-17 09:39:25 +01:00

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

License

MIT © Kevin Mårtensson