@@ -66,21 +66,47 @@ sightengine.check(['nudity', 'type', 'properties','wad','face']).set_file('/full
6666
6767## Moderate a binary image:
6868``` javascript
69- // Detect nudity in an image
70- sightengine .check ([' nudity' ]).set_bytes (binary_image).then (function (result ) {
69+ // Detect nudity, weapons, alcohol, drugs and faces in an image, along with image properties and type
70+ sightengine .check ([' nudity' , ' type ' , ' properties ' , ' wad ' , ' face ' ]).set_bytes (binary_image).then (function (result ) {
7171 // The result of the API
7272}).catch (function (err ) {
7373 // Error
7474});
75+ ```
7576
76- // Detect nudity, weapons, alcohol, drugs and faces in an image, along with image properties and type
77- sightengine .check ([' nudity' , ' type' , ' properties' ,' wad' ,' face' ]).set_bytes (binary_image).then (function (result ) {
77+ ### Use fs.createReadStream
78+ ``` javascript
79+ var binaryImage = fs .createReadStream (path .resolve (__dirname , ' assets' , ' image.jpg' ));
80+
81+ sightengine .check ([' nudity' , ' type' , ' properties' ,' wad' ,' faces' , ' celebrities' ]).set_bytes (binaryImage).then (function (result ) {
7882 // The result of the API
7983}).catch (function (err ) {
8084 // Error
8185});
8286```
8387
88+ ### Use a base64 string
89+ ``` javascript
90+ // var i64 = image64string;
91+
92+ sightengine .check ([' nudity' , ' type' , ' properties' ,' wad' ,' faces' , ' celebrities' ]).set_bytes (i64, ' image.png' ).then (function (result ) {
93+ // The result of the API
94+ }).catch (function (err ) {
95+ // Error
96+ });
97+ ```
98+
99+ ### Use a base64 string from a file
100+ ``` javascript
101+ var i64 = new Buffer (fs .readFileSync (path .resolve (__dirname , ' assets' , ' image.jpg' ))).toString (' base64' );
102+
103+ sightengine .check ([' nudity' , ' type' , ' properties' ,' wad' ,' faces' , ' celebrities' ]).set_bytes (i64, ' image.png' ).then (function (result ) {
104+ // The result of the API
105+ }).catch (function (err ) {
106+ // Error
107+ });
108+ ```
109+
84110# Video and Stream Moderation
85111The first step to detect nudity in a video stream is to submit the video stream to the API.
86112
0 commit comments