jpeg-extract

Extract image files from any jpeg stream

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
jpeg-extract
303.0.14 years ago7 years agoMinified + gzip package size for jpeg-extract in KB

Readme

jpeg-extract
A Node module for extracting images out of jpeg/mjpeg streams

Install

npm i jpeg-extract
yarn add jpeg-extract

Usage

const fs = require('fs')
const extract = require('jpeg-extract')

const url = 'MJPG_URL'

extract(url, (err, img) => {
	if(!err)
		fs.writeFileSync('img.jpg', img)
	else
		console.error(err)
})

Or with promises

const fs = require('fs')
const extract = require('jpeg-extract')

const url = 'MJPG_URL'

extract(url).then(img => {
	fs.writeFileSync('img.jpg', img)
}).catch(err => {
	console.error(err)
})