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 
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:
ext
- One of the supported file typesmime
- The MIME type
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
- archive-type-cli - CLI for this module
License
MIT © Kevin Mårtensson