Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compreface-sdk

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compreface-sdk - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

30

endpoints/detection_endpoints.js

@@ -46,3 +46,31 @@ /*

})
}
},
/**
* Detect faces from given image with blob format
* @param {String} blob
* @param {String} api_key
* @returns {Promise}
*/
async detect_blob_request(blob, url, api_key){
var bodyFormData = new FormData();
bodyFormData.append('file', blob, 'exadel.jpg');
return new Promise( async (resolve, reject) => {
try {
const response = await axios.post( url, bodyFormData, {
headers: {
...bodyFormData.getHeaders(),
"Content-Length": bodyFormData.getLengthSync(),
"x-api-key": api_key
},
})
resolve(response)
} catch (error) {
reject(error)
}
})
},
}

@@ -49,0 +77,0 @@

@@ -69,2 +69,22 @@ /*

return url;
},
base64toblob(b64Data, contentType='image/png', sliceSize=512){
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, {type: contentType});
return blob;
}

@@ -71,0 +91,0 @@ }

2

package.json
{
"name": "compreface-sdk",
"version": "0.5.0",
"version": "0.5.1",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "description": "JavaScript SDK for CompreFace - free and open-source face recognition system from Exadel",

@@ -51,3 +51,4 @@ /*

return new Promise((resolve, reject) => {
detection_endpoints.detect_request(image_path, url, this.key)
image_path = common_functions.base64toblob(image_path);
detection_endpoints.detect_blob_request(image_path, url, this.key)
.then(response => {

@@ -54,0 +55,0 @@ resolve(response.data)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc