Skip to content

Instantly share code, notes, and snippets.

@geek-at
Created August 10, 2020 00:33

Revisions

  1. geek-at created this gist Aug 10, 2020.
    15 changes: 15 additions & 0 deletions example.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    const request = require('request')
    const fs = require('fs');

    var req = request.post("https://nsfw-categorize.it/api/upload", function (err, resp, body) {
    if (err) {
    console.log('Error!');
    } else {
    var json = JSON.parse(body)
    if(json.status=='OK')
    console.log("This image has been classified as",json.data.classification)
    else console.log("Error",json.reason)
    }
    });
    var form = req.form();
    form.append('image', fs.createReadStream('1.jpg'));