tupu-node-sdk
v2.0.2
Published
node.js API sdk for api.open.tuputech.com
Downloads
46
Readme
TUPU NODE SDK USER GUIDE
1、Install tupu-node-sdk
npm install --save tupu-node-sdk
2、Account, Authorization Keys
- Please contact our customer support, to specify your requirements, and apply account / secretId;
- After logined, follow these steps to generate your authorization private / public keys.
3、SDK Examples
- test/image.test.js
- test/text.test.js
- test/video.test.js
API Documentation
Constructor
construct a TUPU API instance
var tupu = new TUPU(secretId, privateKeyPath, options)
secretId
your secretId, contact us to apply your own secretIdprivateKeyPath
/path/to/your/private/key.pemoptions
default: { timeout: 30 * 1000 domain: 'api.open.tuputech.com' # contact us for the other valid values }
Image Methods
1. call TUPU API by urls
tupu.byURLs(urls, options, cb) → {*}
urls
[ 'http://sample.com/path/image.png', 'http://sample.com/path/images.zip' ]options
[optional], {tag: Array | String, uid: String}cb
function(data) 'data' is a json, detail specification can be found here.
2. call TUPU API by POST Files
tupu.byFiles(files, options, cb) → {*}
files
[ '/path/to/file1.jpg', '/path/to/file2.zip' ]options
[optional], {tag: Array | String, uid: String}cb
function(data) 'data' is a json, detail specification can be found here.
3. call TUPU API by readable streams
tupu.byStreams(streams, options, cb) → {*}
streams
[ read stream1 , read stream2 ]options
[optional], {tag: Array | String, uid: String}cb
function(data) 'data' is a json, detail specification can be found here.
Text Methods
call TUPU API by texts
tupu.byTexts(texts, options, cb) → {*}
texts
[ {content: 'some text', contentId: 'your_contentId', ...others}]cb
function(data) 'data' is a json, detail specification can be found here.
Video Methods
1. call TUPU Video Sync API by url
tupu.videoSyncByUrl(url, options, cb) → {*}
url
'http://sample.com/path/video.mp4'options
[optional], {interval: Number | maxFrames: Number | tag: String}cb
function(data) 'data' is a json, detail specification can be found here.
2. call TUPU Video Sync API by POST File
tupu.videoSyncByFile(file, options, cb) → {*}
file
'/path/to/video.mp4'options
[optional], {interval: Number | maxFrames: Number | tag: String}cb
function(data) 'data' is a json, detail specification can be found here.
3. call TUPU Video Sync API by readable stream
tupu.videoSyncByStream(stream, options, cb) → {*}
stream
read streamoptions
[optional], {interval: Number | maxFrames: Number | tag: String}cb
function(data) 'data' is a json, detail specification can be found here.
4. call TUPU Video Async API by url
tupu.videoAsyncByUrl(url, options, cb) → {*}
url
'http://sample.com/path/video.mp4'options
{customInfo: Object | interval: Number | callbackUrl: String | callbackRules: Object | realTimeCallback: Boolean}cb
function(data) 'data' is a json, detail specification can be found here.
5. call TUPU Video Stream API by url
tupu.videoStreamByUrl(url, options, cb) → {*}
url
'rtmp://sample.com/path/stream'options
{customInfo: Object | interval: Number | callbackUrl: String | callbackRules: Object}cb
function(data) 'data' is a json, detail specification can be found here.
6. call TUPU Video Async/Stream Close API
tupu.videoClose(videoId, cb) → {*}
videoId
'5d4c074058b6cbdbfecaaea4'cb
function(data) 'data' is a json, detail specification can be found here.