New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mugshot-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mugshot-js

Javascript/Typescript SDK for Mugshot.dev API

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

mugshot-js

The mugshot-js library provides a JavaScript/TypeScript SDK for interfacing with the Mugshot.dev API, allowing easy integration of face recognition capabilities into your web applications.

Features

  • Add faces to Mugshot.dev for recognition.
  • Search for faces using uploaded images.
  • Delete faces from Mugshot.dev.

Installation

You can install mugshot-js using npm or yarn:

npm install mugshot-js

or

yarn add mugshot-js

Usage

Using the library in browser

import {MugshotClient} from 'mugshot-js';

const client = new MugshotClient('YOUR_API_KEY');

document
	.getElementById('fileInput')
	.addEventListener('change', async function (event) {
		const file = event.target.files[0];
		const metadata = {name: 'John Doe'};

		try {
			const response = await client.addFace(file, metadata);
			console.log(response);
		} catch (error) {
			console.error(error);
		}
	});

Using the library in Edge Environment

import {MugshotClient} from 'mugshot-js';

const client = new MugshotClient('YOUR_API_KEY');

const payload = await request.formData();
const file = payload.get('image');
const metadata = {name: 'John Doe'};

try {
	const response = await client.addFace(file, metadata);
	console.log(response);
} catch (error) {
	console.error(error);
}

Using the library with NodeJS

import {MugshotClient} from 'mugshot-js';

const client = new MugshotClient('YOUR_API_KEY');

const payload = await request.formData();
const file = fs.openAsBlob('person-image.jpg');
const metadata = {name: 'John Doe'};

try {
	const response = await client.addFace(file, metadata);
	console.log(response);
} catch (error) {
	console.error(error);
}

Keywords

FAQs

Package last updated on 21 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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