PixelHosting NPM IntegrationsteemCreated with Sketch.

in #pixelhosting7 years ago

NPM Package Release



Free Image Hosting for Steem Projects


Hello Steem,

to make it easier for developers to integrate PixelHosting into their projects we provide a npm package called pixelhosting.

You can find it at:

https://www.npmjs.com/package/pixelhosting

Install the packe by running npm install pixelhosting --save

Then you can use the libary like this:

let pixel = require('./lib');

let data = ""data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAU4AAAEG.....";

pixel.init({
    api_key: "YOUR_API_KEY",
    api_key_id: "YOUR_API_KEY_ID"
});

pixel.upload(data).then((result) => {
    console.log(result);
});

The result will be an json object like this one:

{
  "secure_url": "https://cdn.pixelhosting.co/wvyez8xyd4/a31ea848d49f5a0a083f5799842b6b09bf196ff2125fd0649b22a783965dc7ff.jpeg",
  "thumbnail_url": "https://cdn.pixelhosting.co/wvyez8xyd4/thumb/a31ea848d49f5a0a083f5799842b6b09bf196ff2125fd0649b22a783965dc7ff.jpeg"
}