Parametric file read, given a message.payload.filename

I am trying to expose a little rest api interface to download files from a given folder.
So the first API return a file list and the second should let the client, download the desired file.

I have not understand yet how to parametrize the file path to serve back to the caller, is it possibile?

Here the flow i working on :

[{"id":"c06e05db.96e4a8","type":"tab","label":"File System","disabled":false,"info":""},{"id":"ca72d632.dfc5f8","type":"fs-file-lister","z":"c06e05db.96e4a8","name":"","start":"C:\\Users\\s.scarinzi\\Desktop","pattern":"*.*","folders":"*","hidden":true,"lstype":"files","path":true,"single":true,"depth":0,"stat":true,"showWarnings":true,"x":380,"y":240,"wires":[["23da456.99b5eba"]]},{"id":"eb542d88.7457f","type":"http in","z":"c06e05db.96e4a8","name":"","url":"getFiles","method":"get","upload":false,"swaggerDoc":"","x":150,"y":240,"wires":[["ca72d632.dfc5f8"]]},{"id":"23da456.99b5eba","type":"http response","z":"c06e05db.96e4a8","name":"","statusCode":"200","headers":{},"x":720,"y":240,"wires":[]},{"id":"bdd968b9.bcee58","type":"http in","z":"c06e05db.96e4a8","name":"","url":"readFile","method":"post","upload":false,"swaggerDoc":"","x":160,"y":420,"wires":[["e2724d4e.80219","1de1fee8.1704a1"]]},{"id":"e2724d4e.80219","type":"debug","z":"c06e05db.96e4a8","name":"IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":350,"y":340,"wires":[]},{"id":"588ac55.dafe03c","type":"debug","z":"c06e05db.96e4a8","name":"OUT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":560,"y":340,"wires":[]},{"id":"1de1fee8.1704a1","type":"file in","z":"c06e05db.96e4a8","name":"","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":380,"y":440,"wires":[["588ac55.dafe03c"]]}]

Here is a working demo

https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.