1.0.0 • Published 6 years ago

buffer-type v1.0.0

Weekly downloads
551
License
MIT
Repository
github
Last release
6 years ago

buffer-type

NPM version NPM quality build status Test coverage David deps Known Vulnerabilities NPM download

Detect content-type from Buffer data.

Install

$ npm install buffer-type

Usage

const bt = require('buffer-type');
const fs = require('fs');

const info = bt(fs.readFileSync(__dirname + '/logo.png'));
console.log(info);
// {
//   type: 'image/png',
//    extension: '.png',
//    width: 618,
//    height: 96,
//    bit: 8, // bit depth
//    color: 6,
//    compression: 0,
//    filter: 0,
//    interlace: 0
// }

References

TODO

  • Image
  • Tar
    • .tar
    • .gzip
    • .zip
    • .rar
  • PE file
    • .exe
    • .msi
    • .apk
    • .ipa
  • Text
    • .xml
    • .html
    • .json
  • Media
    • .mp3
    • .mp4
    • .avi

License

MIT