0

I've built an application which allows users to submit a request on the front end, which is then handled by node and fires off a python script. This python script then returns a data object to node, sometimes multiple hundreds of objects in an array. If possible I would like to limit what I send back to the client in node, say the first 50 objects. Can this be done ?

Current code:

app.post('/upload', upload.single('myImage'), function (req, res, next) {

    const options = {
        scriptPath: './playground/',
        args: ['--graph', './playground/tf_files/retrained_graph.pb', '--image', './uploads/' + req.file.filename]
    };

    PythonShell.run('scripts/label_image.py', options, function (err, pyRes) {
        if (err) throw err;
        const obj = JSON.parse(pyRes[1])
        res.send({ result: obj }); // I would like to limit this obj
    });
});
alienbuild
  • 246
  • 2
  • 15

0 Answers0