Socket
Book a DemoInstallSign in
Socket

archive-type

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archive-type

Detect the archive type of a Buffer/Uint8Array

latest
Source
npmnpm
Version
4.0.0
Version published
Weekly downloads
853K
-16.05%
Maintainers
2
Weekly downloads
 
Created
Source

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

Keywords

7zip

FAQs

Package last updated on 25 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts