IPWorks ZIP 2020 Node.js Edition

Questions / Feedback?

ExtractToPath Property

A base path to decompress to.

Syntax

 jar.getExtractToPath([callback])
 jar.setExtractToPath( extractToPath, [callback])

Default Value

""

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getExtractToPath([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setExtractToPath([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

Setting the ExtractToPath property affects the operation of the Extract and ExtractAll methods. Setting this property to a nonempty string will cause all decompressed files to be written to the specified path. If pathnames are given in the values of FileDecompressedName they will be regarded as relative to ExtractToPath.

If the specified directory does not exist, it will be created when extraction is done.

ExtractToPath should always be specified in the format native to the host operating system, and with a trailing slash or backslash. If the path is specified otherwise, it will be immediately converted and stored in the converted format. For example, "/temp" would be immediately converted to "\temp\" on a Windows system.

Example (Extracting from an Archive)


ZipControl.ArchiveFile = "c:\temp.zip"
ZipControl.ExtractToPath = "c:\extracted\"
ZipControl.ExtractAll()

Example - Adding Files

Dim i as Integer
ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.Scan()
For i = 0 to ZipControl.Files.Count - 1
  ZipControl.Files(i).DecompressedName(i) = "c:\temp\" + ZipControl.Files(i).DecompressedName
Next i
ZipControl.ExtractToPath = ""
ZipControl.ExtractAll()
ZipControl.IncludeFiles("c:\extra\*")
ZipControl.Compress()

Data Type

String

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 Node.js Edition - Version 20.0 [Build 8300]