Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Extract – PB Docs 2022 – PowerBuilder Library

Extract – PB Docs 2022

Extract

PowerScript function

Description

Extracts the compressed archive or data stream.

Applies to

ExtractorObject objects

Syntax 1: Extracts the compressed
archive

Syntax 2: Extracts the specified files (or
folders) from the specified package

Syntax 3: Extracts the specified file from the
compressed package into a blob

Syntax 4: Extracts the compressed blob
data

Argument

Description

objectname

The name of the ExtractorObject object.

source

A string whose value is the full directory of the
compressed archive.

Or a blob whose value is the compressed data
stream.

items[]

The specified files (or folders) to extract. The files (or
folders) can be obtained through GetFilesList.

If you specify a single file in a subfolder, the method
will create the whole folder structure to the file on
target.

item

The specified file to extract. You can only extract one
file (cannot be multiple files or a folder) into a blob.

target

A string whose value is the directory where the compressed
archive will be extracted. The existing files with the same name
on target will be overwritten.

Or a blob where the decompression results will be
stored.

format (optional)

A value of the enumerated datatype ArchiveFormat
specifying the format of the source file. Values are:

  • ArchiveFormatZIP!: zip file. This is the default
    value.

  • ArchiveFormat7Zip!: 7zip file. File size of 7zip file
    may not be obtained correctly during extraction.

  • ArchiveFormatRAR!: rar file.

  • ArchiveFormatGZip!: gzip format archive.

  • ArchiveFormatTAR!: tar format archive.

  • ArchiveFormatLZMA!: lzma format archive.

  • ArchiveFormatLZMA86!: lzma86 format archive.

Usage

The Extract method determines the archive format according to the
file extension; therefore, if the file extension has been changed manually
(for example, from .rar to .zip), the Extract method will fail to extract
the file and will return the error code -10.

When extracting to a blob data, you can only extract one file
(rather than a folder or multiple files) into a blob.

Return value

Integer.

Returns the following value. If any argument’s value is null, the
method returns null.

1 — Success

-1 — A general error occurred.

-2 — The password entered is illegal.

-3 — The operation is not supported for the source file
format.

-4 — The task thread is aborted.

-5 — A task thread is currently running.

-6 — No password is entered. You must enter the password.

-7 — The password is incorrect.

-8 — Failed to get new memory when saving the decompressed
file.

-9 — Failed to read the compressed file.

-10 — Unrecognized format or the encrypted file name option is used
when compressing the document.

-11 — Access denied when extracting the archive.

-12 — The compressed file does not exist.

-13 — The directory where the decompressed file will be saved does
not exist.

-14 — Failed to extract the compressed file.

-15 — The file to be decompressed is not in the package.

-16 — The current operation does not support the folder
decompression.

Example 1

This example demonstrates how to extract a compressed
package.

Example 2

This example demonstrates how to compress and extract a blob
data.

Example 3

This example extracts two files (test1.txt, test2.txt) and a folder
(test_folder) from the package.

Example 4

This example extracts test1.txt from the package into a blob data.
You can only extract one file (not a folder or multiple files) into a
blob.

See also

Cancel

GetFilesCount

GetFilesList


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x