Skip to content

Javascript

Inteliver Node.js SDK

Warning

We are updating SDKs to be compatibale with our latest changes.

Note

Please visit our Github page for more information.

NodeInteliver

Using our Node.js sdk you can upload, set configs and retrieve your data.

Installation

This python package is available at node package manager npm.

simply run the following command to be able to use our nodejs API.

    npm install nodeinteliver

You can also pull our repository and use the API without any requirements to install.

    git pull https://github.com/inteliver/nodeinteliver.git

Inteliver Configs

After registering in Inteliver you will have a cloud-name and token.

This pair will be used to authenticate you for uploading data or using intelligent service. To set this in your code simply:

Create InteliverConfig
jsi = require("./nodeinteliver")

config = new jsi.InteliverConfig(cloudname="your-cloudname", token="your-token")

Upload

To upload your data first set your config object. Then use the following lines:

jsi = require("./nodeinteliver")
iu = new jsi.Uploader(config)
file_key = iu.upload('your-image.jpg')

If uploaded successfully you will receive a json file with following format.

{
    'success': True,
    'message': 'Successfully uploaded.',
    'resource_key': RETURNED_RESOURCE_KEY
}

resource_key is a unique key which able you to receive your data later.

Retrieve Data

Using InteliverRetrieve class you can build the URL of the data you need to get from Inteliver.

To retrieve your data first set your config object. After setting your config object, build an InteliverRetrieve object.

jsi = require("./nodeinteliver")

config = new jsi.InteliverConfig(cloudname=your-cloudname, token=your-token)
rt = new jsi.InteliverRetrieve(config)

Tip

Note that for retrieving data you only need your cloudname to be set.

All the modifications are sequentional.

For example lets say you want to select the main face in picture resize it to 200 and 200 and keep the original ratio and to crop the image in a rounded shape and change the format to png and build the url.

let say your resource image is this one:

Original Image

    rt.select_face()
    rt.select('height', 200)
    rt.select('width', 200)
    rt.image_crop(round_crop=True)
    rt.image_change_format('PNG')
    url_to_get = rt.build_url(your_resource_key)

This will build a url like this:

"http://res.inteliver.local/media/v1/yourcloudname/i_c_face,i_w_200,i_h_200,i_o_crop,i_o_rcrop,i_o_format_png/resourcekey.jpg"

The image you receive after modification is :

Modified Image

Info

You can find out about the image modification examples at inteliver Examples.