Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatelei/imagetype
Get correct image type
https://github.com/fatelei/imagetype
Last synced: about 1 month ago
JSON representation
Get correct image type
- Host: GitHub
- URL: https://github.com/fatelei/imagetype
- Owner: fatelei
- Created: 2014-10-25T05:18:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-25T06:42:21.000Z (about 10 years ago)
- Last Synced: 2024-11-14T11:39:53.811Z (about 1 month ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
imagetype
=========Get correct image type
## Install
```
npm install imtype
```## Support Image type
+ jpeg
+ png
+ gif
+ tiff
+ bmp- - -
## Usage
```
var imtype = require('imtype');
var fs = require('fs');// isJPG;
var data = fs.readFileSync('foo.jpg');
console.log(imtype.isJPG(data));// isPNG
var data = fs.readFileSync('foo.png');
console.log(imtype.isPNG(data));// isGIF
var data = fs.readFileSync('foo.gif');
console.log(imtype.isGIF(data));// isBMP
var data = fs.readFileSync('foo.bmp');
console.log(imtype.isBMP(data));// isTIF
var data = fs.readFileSync('foo.tif');
console.log(imtype.isTIF(data));
```## Test
```
make test
```