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

Compress – PB Docs 2021 – PowerBuilder Library

Compress – PB Docs 2021

Compress

PowerScript function

Description

Compresses the folder or one or more files, or the byte data
stream.

Applies to

CompressorObject objects

Syntax

Argument

Description

objectname

The name of the CompressorObject object.

source

A string whose value is the full directory of the folder
or one or more files that will be compressed. If there are more
than one source file with the same name, they will be recognized
as the same file, although they are from different directories;
and in such case the method will return the error code
-11.

Or a blob whose value is the byte data that will be
compressed.

dest

A string whose value is the target directory as well as
the file name where the compressed file or folder will be
located.

Or a blob value specifying the target compressed
stream.

format (optional)

A value of the enumerated datatype ArchiveFormat
specifying the the format of the target file. The supported
values are:

  • ArchiveFormatZIP! — zip file. Supports AES-256
    encryption for password. This is the default value.

  • ArchiveFormat7Zip! — 7zip file. Supports AES-256
    encryption for password.

  • ArchiveFormatGZip! — gzip format archive. Supports
    compressing a single file.

  • ArchiveFormatTAR! — tar format archive.

If the extension in “dest” is inconsistent with the format
specified in “format”, the file or folder will be compressed
according to the format specified in “format” and the extension
of “dest” will not be revised.

Usage

The Compress method cannot append files or folders to an existing
compressed file; instead it will overwrite the existing compressed file
with the subsequent files or folders.

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. If the CompressorObject object is
used in asynchronous mode, this function will return the general
error.

-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 — The folder to be compressed does not exist.

-7 — The folder to be compressed is empty.

-8 — The compression format does not support multi-file
compression.

-9 — Failed to read file from the folder for compression.

-10 — The target path does not exist.

-11 — More than one source file has the same file name.

-12 — Invalid compressed file name or no compressed file name is
specified in the “dest” argument.

-13 — Failed to compress.

Example 1

This example demonstrates how to compress a folder.

Example 2

This example demonstrates how to compress a single file.

Example 3

This example demonstrates how to compress multiple files.

Example 4

This example demonstrates how to compress the data stream.

See also

Cancel


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