Index face module code

This code will extract the feature information of faces stored in the S3 bucket and store them in the piCollection that we created earlier using the AWS CLI tool.

Create a file with the name indexFaces.js and include the npm modules aws-sdk and fs in it. Make sure these modules are installed or run npm install command in the terminal to do the installation, as shown in Figure 7.28 and Figure 7.29:

Figure 7.28
Figure 7.29

In the indexFaces.js file, add both modules using require:

var AWS = require('aws-sdk'),fs = require('fs'); ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.