Large file download using grails

后端 未结 1 1404
醉酒成梦
醉酒成梦 2021-01-05 12:29

I am working on a grails application, it has a file sharing feature. It uploads files onto the server and allows user to download the file from server. I used the following

1条回答
  •  再見小時候
    2021-01-05 13:07

    Instead of loading the file into memory, replace

    response.getOutputStream() << new ByteArrayInputStream(file.getBytes())
    

    With:

    file.withInputStream { response.outputStream << it }
    

    0 讨论(0)
提交回复
热议问题