/// <summary> /// Downloads a specific file from a remote .zip archive /// </summary> /// <param name="archiveUrl">URL of the .zip archive</param> /// <param name="filePath">Path of the file</param> /// <returns>File content</returns> public static async Task <byte[]> DownloadFile(string archiveUrl, string filePath) { PartialZipDownloader downloader = new PartialZipDownloader(archiveUrl); PartialZipInfo info = await downloader.Open(); byte[] content = await downloader.Download(info, filePath); return(content); }
/// <summary> /// Downloads a specific file from a remote .zip archive /// </summary> /// <param name="archiveUrl">URL of the .zip archive</param> /// <param name="filePath">Path of the file in archive</param> /// <param name="writePath">Path where the file will be written</param> /// <param name="preserveTime">Preserve modification date</param> /// <returns>File content</returns> public static async Task DownloadFile(string archiveUrl, string filePath, string writePath) { PartialZipDownloader downloader = new PartialZipDownloader(archiveUrl); PartialZipInfo info = await downloader.Open(); var content = await downloader.Download(info, filePath); File.WriteAllBytes(writePath, content.Item1); File.SetLastWriteTimeUtc(writePath, content.Item2); }