ZipHelper
This module contains helper function to create and extract zip archives.
Functions and values
Function or value | Description |
CreateZip (...)
Signature: workingDir:string -> fileName:string -> comment:string -> level:int -> flatten:bool -> files:seq<string> -> unit
|
Creates a zip file with the given files
Parameters
workingDir - The relative dir of the zip files. Use this parameter to influence directory structure within zip file.
fileName - The fileName of the resulting zip file.
comment - A comment for the resulting zip file.
level - The compression level.
flatten - If set to true then all subfolders are merged into the root folder.
files - A sequence with files to zip.
|
CreateZipOfIncludes (...)
Signature: fileName:string -> comment:string -> level:int -> files:seq<string * FileIncludes> -> unit
|
Creates a zip file with the given files.
Parameters
fileName - The file name of the resulting zip file.
comment - A comment for the resulting zip file.
level - The compression level.
files - A sequence of target folders and files to include relative to their base directory.
|
DefaultZipLevel
Signature: int
|
The default zip level
|
Unzip target fileName
Signature: target:string -> fileName:string -> unit
|
Unzips a file with the given file name.
Parameters
target - The target directory.
fileName - The file name of the zip file.
|
UnzipFirstMatchingFileInMemory (...)
Signature: predicate:(ZipEntry -> bool) -> zipFileName:string -> string
|
Unzips a single file from the archive with the given file name.
Parameters
predicate - The predictae for the searched file in the archive.
zipFileName - The file name of the zip file.
|
UnzipSingleFileInMemory (...)
Signature: fileToUnzip:string -> zipFileName:string -> string
|
Unzips a single file from the archive with the given file name.
Parameters
fileToUnzip - The file inside the archive.
zipFileName - The file name of the zip file.
|
Zip workingDir fileName files
Signature: workingDir:string -> fileName:string -> files:seq<string> -> unit
|
Creates a zip file with the given files.
Parameters
workingDir - The relative dir of the zip files. Use this parameter to influence directory structure within zip file.
fileName - The file name of the resulting zip file.
files - A sequence with files to zip.
|
ZipFile fileName targetFileName
Signature: fileName:string -> targetFileName:string -> unit
|
Creates a zip file with the given file.
Parameters
fileName - The file name of the resulting zip file.
targetFileName - The file to zip.
|
ZipOfIncludes fileName files
Signature: fileName:string -> files:seq<string * FileIncludes> -> unit
|
Creates a zip file with the given files.
Parameters
fileName - The file name of the resulting zip file.
files - A sequence of target folders and files to include relative to their base directory.
Sample
The following sample creates a zip file containing the files from the two target folders and FileIncludes.
- The files from the first FileInclude will be placed in the root of the zip file.
- The files from the second FileInclude will be placed under the directory
app_data\jobs\continuous\MyWebJob in the zip file.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
|
Target "Zip" (fun _ ->
[ "", !! "MyWebApp/*.html"
++ "MyWebApp/bin/**/*.dll"
++ "MyWebApp/bin/**/*.pdb"
++ "MyWebApp/fonts/**"
++ "MyWebApp/img/**"
++ "MyWebApp/js/**"
-- "MyWebApp/js/_references.js"
++ "MyWebApp/web.config"
@"app_data\jobs\continuous\MyWebJob", !! "MyWebJob/bin/Release/*.*"
]
|> ZipOfIncludes (sprintf @"bin\MyWebApp.%s.zip" buildVersion)
)
|
val sprintf : format:Printf.StringFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
|