What's the best way to serve up multiple binary files from a single WebApi method?

前端 未结 3 996
清酒与你
清酒与你 2020-12-05 19:38

I have an ASP.NET MVC 4 Web Api controller method that gets passed a list of file IDs and returns thumbnail images for those files.

So, the client might pass in a li

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 19:50

    You could create a compressed file (e.g. a ZIP file) out of all the thumbnails and send that back.

    Then the caller just has to unzip it their end - sending a single file containing multiple files is going to be far more acceptable then sending multiple files in a single stream.

    Disadvantage is you're less likely to be able to take advantage of caching (depending on your usage patterns of course).

提交回复
热议问题