![]() In real-life, input parameters would often be required for the backend to know what to zip, but I'll leave that part out for simplicity. I'm picking the MVC template, but none of the zip-related code is specific to MVC.įor this example, I'll create a single endpoint able to zip and download some files. To get started, I'll create a new ASP.NET Core website: dotnet new mvc Zipping the files before downloading them, turned out as a great way of easily implementing multi-file download.NET offers all of the needed features and in this post, I'll show you how to implement it. Return send_bytes(archive, "some_name.Written by Thomas Ardal, January 31, 2023įor a recent feature, I had to download a batch of files from an internal website written in ASP.NET Core. With zipfile.ZipFile(archive, mode="w") as zf: But how can I download this stream using dcc.download? import ioįrom dash_extensions.snippets import send_bytes I modified the code that the zip file is created in a stream. Well, I tried to make it out of this thread you postet and I think I’m not far away to achive it. With zipfile.ZipFile(zip_file_name, mode="w") as zf: For the moment the zip is going to be safed at the same point in system where the executed file is stored.įrom pendencies import Output, InputĪpp = dash.Dash(prevent_initial_callbacks=True)Īpp.layout = html.Div([html.Button("Download zip", "data"), Creating the zip works fine but I’ve no idea how to hand it over to the output of the dcc.downlaod. I would like to create a zip file and download it by using dcc.download.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |