Created
August 24, 2017 14:32
-
-
Save 5un/842ac39b24599fe93d18a0c536f0ea69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('superagent') | |
const agent = require('superagent-bluebird-promise') | |
var http = require('http') | |
var fs = require('fs') | |
var API_URL = 'https://api.chui.ai/v1' | |
var apiKey = 'TRUEFACE_API_KEY' | |
fs.readFile('myimg.jpg', function (err, file){ | |
var base64 = new Buffer(file).toString('base64'); | |
agent | |
.post('https://api.chui.ai/v1' + '/facedetect') | |
.send({ img: base64 }) | |
.set('x-api-key', apiKey) | |
.then(response => { | |
console.log('request successful'); | |
console.log(response.body); | |
}) | |
.catch(err => { | |
console.error(err); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment