Last active
May 16, 2019 11:21
-
-
Save unitycoder/edfc22570e93db61f83d582c98c4dff5 to your computer and use it in GitHub Desktop.
Unity SharpCompress Test - Create Zip package from files in folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unity sharpcompress example : https://unitycoder.com/blog/2019/05/12/using-sharpcompress-in-unity/ | |
// https://github.com/adamhathcock/sharpcompress | |
using SharpCompress.Archives; | |
using SharpCompress.Archives.Zip; | |
using System.IO; | |
using UnityEngine; | |
public class SharpCompressTest : MonoBehaviour | |
{ | |
void Start() | |
{ | |
// ZipArchive with Writing API Example: (creates zip file from source folder files) | |
using (var archive = ZipArchive.Create()) | |
{ | |
string sourceFolder = "d:/data/testzip"; | |
archive.AddAllFromDirectory(sourceFolder); | |
string outputPath = "d:/data/test.zip"; | |
using (FileStream fs = File.Create(outputPath)) | |
{ | |
archive.SaveTo(fs); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment