opizo-api
opizo.com shortener api module for node.js. (client)
All functions return a promise
Installation
with npm:
$ npm install --save opizo-api
or with yarn:
$ yarn add opizo-api
Example
Request to get short url:
const opizo = ; // Not need to setUsername you can use without login // Just request to short a url ;
Request to get short url and file info:
const opizo = ; // Optional (you can leave it blank or just don't call this function)// username on here or set as environment varialbeopizo // Request to short a url and get file name and size infoopizo ;
functions
Use main function, when you require module you can use it as function like below(opizo is the variable name but after required it is main function):
const opizo = ;
opizo(your-url)
: request short linkopizo.extra(your-url)
: request short link & file infoopizo.setUse(your-username)
: optional, set the username to make your link manageable, you can also use environment variable like this:
$ export OPIZO_USERNAME='your-user-name-here'
or just don't call this function.
Result object
On main function returned result object have below property:
url
: Requested urlshortUrl
: short url if request not failed
On extra function returned result object have below property:
url
: Requested urlshortUrl
: Short url if request not failedfileInfo
: File info if request not failedname
: File name if existssizeInMB
: File size in pretty formatcontentLength
: File size in kb
err
object
Error object on catch have below property:
code
: Internal error codemessage
: Internal error messageresult
: This is result objectrp
: More detailscode
: Error codemessage
: Error message