Complexity Score
Low
Open Issues
N/A
Dependent Projects
42
Weekly Downloadsglobal
2,088,079
Downloads
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
Dependencies
CVE IssuesActive
0
Scorecards Score
3.00
Test Coverage
No Data
Follows Semver
Yes
Github Stars
25
Dependenciestotal
4
DependenciesOutdated
2
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data
Learn how to distribute archive-type in your own private NPM registry
$npm config set registry
https://npm.cloudsmith.com/owner/repo
/Processing...
✓Done
$npm install archive-type
/Processing...
✓Done
18 Releases
NPM on Cloudsmith