Skip to content

Instantly share code, notes, and snippets.

@5un
Created August 24, 2017 14:32
Show Gist options
  • Save 5un/842ac39b24599fe93d18a0c536f0ea69 to your computer and use it in GitHub Desktop.
Save 5un/842ac39b24599fe93d18a0c536f0ea69 to your computer and use it in GitHub Desktop.
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