2.0.2 • Published 3 years ago

tupu-node-sdk v2.0.2

Weekly downloads
10
License
ISC
Repository
github
Last release
3 years ago

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 secretId
  • privateKeyPath /path/to/your/private/key.pem
  • options 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) → {*}

2. call TUPU API by POST Files

tupu.byFiles(files, options, cb) → {*}

3. call TUPU API by readable streams

tupu.byStreams(streams, options, cb) → {*}

Text Methods

call TUPU API by texts

tupu.byTexts(texts, options, cb) → {*}

Video Methods

1. call TUPU Video Sync API by url

tupu.videoSyncByUrl(url, options, cb) → {*}

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 stream
  • options 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.

License

MIT

2.0.2

3 years ago

2.0.1

7 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago