node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey ยป



Image proxy and base64 string generator.

Requests are proxied to by default.

Used by dyson-generators (for base64 image strings) and dyson (as middleware).


Install dyson-image locally by including it in package.json as a devDependency:

"devDependencies": {
    "dyson-image": "~0.1"


Image buffer

The image.request() method returns a promise which gets resolved with an object containing mimeType and buffer.

The examples below both create a base64 string representation of a 300x200 image:

var image = require('dyson-image');

    host: '',
    path: '/300x200'
}).then(function(imageObj) {
    var imgBase64 = imageObj.buffer.toString('base64');
    console.log('data:' + imageObj.mimeType + ';base64,' + imgBase64);

    width: 300,
    height: 200
}).then(function(imageObj) {

Middleware for Express

var image = require('dyson-image');

app.get('/image/*', image.asMiddleware);

A request to /image/300x200 will be proxied to, and served as image.

Development & run tests

git clone
cd dyson-image
npm install
npm test