This article is a mirror article of machine translation, please click here to jump to the original article.

View: 30128|Reply: 0

[.NET Core] asp.net core bulk renames zip packets in memory

[Copy link]
Posted on 1/23/2021 12:16:31 PM | | | |
When a user uploads a zip package file to my interface in POST, I need to rename the folder and file name in the zip, which is due to the need of project rules. How to rename the zip package without decompressing it, rename it, and then repackage it, and rename the zip package directly in memory? This article uses the ICSharpCode.SharpZipLib plugin to rename zip packages in memory.

Due to project requirements, you need to rename the files in the zip package uploaded by the user according to certain rules, and this article will operate directly in memory.

First, the compressed package file structure is as follows:



I need to rename the "spc1230" folder and file of the compressed package to a string of GUIDs.

The code is as follows:

Calling Code:

After execution, the folder inside the compressed package is successfully renamed without any errors, as shown in the following image:




(End)




Previous:asp.net core 3.1 enables the website Brotli compression algorithm
Next:ASP.NET the IIS 10 AlwaysRunning preloading feature of MVC 5
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com