image-info-from-stream
v0.3.0
Published
access image info from stream
Downloads
3
Readme
image info from stream
introduction
access image size from stream.
support image file types:
.jpg
.png
.gif
.bmp
usage
Callback
const getImageInfo = require('image-infor-from-stream');
const stream = fs.createReadStream('test.png');
stream.pipe(
getImageInfo(res => {
const { width, height, type } = res;
const name = `${width}x${height}.${type}`;
})
);
External Object
const getImageInfo = require('image-infor-from-stream');
const stream = fs.createReadStream('test.png');
const meta = {};
stream
.pipe(getImageInfo(meta))
.on('finish', () => {
const { width, height, type } = meta;
const name = `${width}x${height}.${type}`;
});