Skip to content

node-modules/buffer-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    • [√] .png
    • [√] .jpg
    • [√] .bmp
    • [√] .gif
    • [√] .webp
    • .svg
    • .tif
    • .psd
  • Tar
    • .tar
    • .gzip
    • .zip
    • .rar
  • PE file
    • .exe
    • .msi
    • .apk
    • .ipa
  • Text
    • .xml
    • .html
    • .json
  • Media
    • .mp3
    • .mp4
    • .avi

License

MIT

About

Detect content-type from Buffer data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published