File Zipper¶
The File Zipper project is a module designed to provide file zipping capabilities within a GridLab Application Modules. It leverages modularity and localization features to offer a robust and maintainable solution for file compression.
Installation¶
If you want to install file zipper;
-
Add the GridLab.Abp.FileZipper NuGet package to your project:
Install-Package GridLab.Abp.FileZipper
-
Add the
AbpFileZipperModule
to the dependency list of your module:[DependsOn( //...other dependencies typeof(AbpFileZipperModule) // <-- Add module dependency like that )] public class YourModule : AbpModule { }
Using File Zipper¶
To use the GridLab.Abp.FileZipper module in your application, follow these steps:
- Inject the IFileZipperFactory: Inject the IFileZipperFactory into your service or controller:
public class MyFileService
{
private readonly IFileZipperFactory _fileZipperFactory;
public MyFileService(IFileZipperFactory fileZipperFactory)
{
_fileZipperFactory = fileZipperFactory;
}
public void ZipFiles(IEnumerable<string> filePaths, string outputZipPath)
{
var fileZipper = _fileZipperFactory.Create();
fileZipper.ZipFiles(filePaths, outputZipPath);
}
}
- Use the IFileZipper: Use the IFileZipper instance to zip files:
public void ZipFiles(IEnumerable<string> filePaths, string outputZipPath)
{
var fileZipper = _fileZipperFactory.Create();
fileZipper.ZipFiles(filePaths, outputZipPath);
}