刘琳琳 97c35fdf0d 航汇HHArome小程序容器演示 | 2 months ago | |
---|---|---|
.. | ||
node_modules | 2 months ago | |
index.js | 2 months ago | |
license | 2 months ago | |
package.json | 2 months ago | |
readme.md | 2 months ago |
Detect the archive type of a Buffer/Uint8Array
$ npm install --save archive-type
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'}
Returns an Object
with:
ext
- One of the supported file typesmime
- The MIME typeOr null
when no match.
Type: Buffer
Uint8Array
It only needs the first 262 bytes.
7z
bz2
gz
rar
tar
zip
xz
gz
MIT © Kevin Mårtensson