@xhmikosr/archive-type
Detect the archive type of a Buffer/Uint8Array
Last updated 6 months ago by xhmikosr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @xhmikosr/archive-type 
SYNC missed versions from official npm registry.

@xhmikosr/archive-type npm version CI Status

Detect the archive type of a Buffer/Uint8Array

Install

npm install @xhmikosr/archive-type

Usage

import archiveType from '@xhmikosr/archive-type';
import {readChunk} from 'read-chunk';

const buffer = await readChunk('unicorn.zip', 0, 262);

await 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
  • pkg
  • rar
  • tar
  • tar.gz
  • xz
  • zip
  • zst

Related

License

MIT © Kevin Mårtensson

Current Tags

  • 8.1.0                                ...           latest (6 months ago)

8 Versions

  • 8.1.0                                ...           6 months ago
  • 8.0.1                                ...           9 months ago
  • 8.0.0                                ...           9 months ago
  • 7.1.0                                ...           a year ago
  • 7.0.0                                ...           3 years ago
  • 6.0.1                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 11
Today 0
This Week 1
This Month 9
Last Day 0
Last Week 8
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE