0

我正在尝试创建 zip 文件(使用 vb2005)。如果 zip 文件将超过 1GB 代码将无法工作......我尝试了以下代码。

Imports System.IO.Compression
Imports System.IO.Packaging

strDownloadFilePath= txtpath.text

Dim clsNewZip As Package = Nothing

clsNewZip = ZipPackage.Open(strDownloadFilePath, _
     IO.FileMode.OpenOrCreate,FileAccess.ReadWrite)

Dim uriFileName As String = strDestinationPath.Replace(" ", "_")

Dim zipUri As String = String.Concat("/", IO.Path.GetFileName(uriFileName))
Dim partUri As New Uri(zipUri, UriKind.Relative)
Dim contentType As String = Net.Mime.MediaTypeNames.Application.Zip
Dim pkgPart As PackagePart = clsNewZip.CreatePart(partUri,contentType, _
         CompressionOption.Normal)
Dim bites As Byte() = File.ReadAllBytes(strDestinationPath)

pkgPart.GetStream().Write(bites, 0, bites.Length)

clsNewZip.Close()
4

0 回答 0