A way to send a file from server to client in JSreport



  • Hello,

    is it possible to create an endpoint in JSreport in order to get a file from a server ?
    or to send a file from a script or from the handlebars helpers functions ?
    I m using jsreport.render function in report.params (client side) with params and stuff related to client, and I have a template and a script dependent on those params, the script is sending a query to API and creating a csv file, and I want to send that file to the client so he can download it,
    I don't want to use xlsx recipe because the file is so huge and using xlsx recipe will use a lot of memory.

    if not, do you have any other ideas maybe ?


  • administrators

    hi!

    is it possible to create an endpoint in JSreport in order to get a file from a server ?

    this is possible by creating an extension, for example on the version-control extension we create some new endpoints to be able to execute custom logic.

    or to send a file from a script or from the handlebars helpers functions ?
    I m using jsreport.render function in report.params (client side) with params and stuff related to client, and I have a template and a script dependent on those params, the script is sending a query to API and creating a csv file, and I want to send that file to the client so he can download it

    i think the easiest for you is to create an afterRender script and then send the generated csv file via email as an attachment so user can download it, however, this is just a general idea, i'm not 100% sure about the real flow you want to achieve, because if you are doing the render from client side then you can also let jsreport finish the render and just receive the output (which should be the csv) and trigger a download on the client-side.



  • Thank you so much for your response:)


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.