图普科技-图像识别云服务 Node.js API
Switch branches/tags
Nothing to show
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.
lib bug fixed: console() -> console.error() Aug 11, 2017
out change TUPU constructor Aug 2, 2016
test merge Sep 20, 2016
LICENSE update SDK, add uid/tag params Sep 20, 2016
README.md update SDK, add uid/tag params Sep 20, 2016
package.json update version Aug 11, 2017

README.md

tuputech

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;
  • Affter logined, follow these steps to generate your authorization private / public keys.

3、SDK Examples

var secretId = 'you_secretId'
var domain = 'api.open.tuputech.com'
var privateKeyPath = __dirname + '/my_private_key.pem'
var TUPU = require('tupu-node-sdk')
var tupu = new TUPU(secretId, privateKeyPath, { domain: domain, timeout: 10 * 1000 })

var testUrls = [
    'http://sample.com/1469532933675594/953.jpg'
    , 'http://sample.com/1469534372014467/233.jpg'
]

var options = {
	uid: 'you_uid'
	, tag: ['tag-test', 'tag-test-2']
}

tupu.byURLs(testUrls, options, function (data) {
    console.log(data)
})

var testFiles = [
    '/Users/testImage/266.jpg'
    , '/Users/testImage/267.jpg'
]

tupu.byFiles(testFiles, options, function (data) {
    console.log(data)
})

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 }

Methods

1. call TUPU API by urls

tupu.byURLs(urls, options, cb) → {*}

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.

License

MIT