Skip to content
An API-wrapper for Kie's Image Machine. Completely anonymous image hosting.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.npmignore
LICENSE
README.md
package-lock.json
package.json

README.md

kim-api

An API-wrapper for Kie's Image Machine (kim). Completely anonymous image hosting.

  • Unlimited image uploads
  • No api key required
  • No config files required
  • Built on request

kim supports the following file extensions: png, jpg, jpeg, gif


Uploading an image to kim.

// require kim-api
const kim = require('kim-api');
const path = require('path');

// upload
kim.upload(path.join(__dirname, 'image.png'))
    .then(img => {
        console.log(img.url);
    })
    .catch(err => {
        // ...
    })

Installation

npm

$ npm install kim-api

yarn

$ yarn add kim-api

Methods

.upload(file)

Upload an image to kim. Returns a promise.

Example response:

{
    "status":"success",
    "data":{
        "image_id":"DQNMMxSm8SbYSJVt15cecbke8LqsidfE",
        "filetype":"png"
    },
    "url": "https://kim.kieranhowland.co.uk/uploads/DQNMMxSm8SbYSJVt15cecbke8LqsidfE/"
}

.datauri(imageID)

Get the datauri of an image uploaded to kim. Returns a promise.

Example response:

{
    "status":"success",
    "data": {
        "uri":"data:image/png;base64,iVBORw0..."
    }
}

.uploads()

Get the total amount of images uploaded to kim. Returns a promise.

Example response:

{
    "status":"success",
    "data":{
        "uploads": 4627
    }
}

Errors

If there's an error on kim server-sided, an Error will be thrown.

Error: kim-api error: recieved status code 400 - invalidFileExtension
    // stack trace ...

If not all arguments required for a method are provided, a TypeError will be thrown.

TypeError: No image provided.
    // stack trace ...

.catch() these errors to prevent UnhandledPromiseRejectionWarnings.

You can’t perform that action at this time.