zlib

The DolphinDB zlib plugin supports zlib compression and decompression from file to file.

Installation (with installPlugin)

Required server version: DolphinDB 2.00.10 or higher.

Supported OS: Linux x86-64, Linux_JIT x86-64, Linux ARM, Linux ABI.

Installation Steps:

(1) Use listRemotePlugins to check plugin information in the plugin repository.

Note: For plugins not included in the provided list, you can install through precompiled binaries or compile from source. These files can be accessed from our GitHub repository by switching to the appropriate version branch.

login("admin", "123456")
listRemotePlugins(, "http://plugins.dolphindb.com/plugins/")

(2) Invoke installPlugin for plugin installation

installPlugin("zlib")

(3) Use loadPlugin to load the plugin before using the plugin methods.

loadPlugin("zlib")

Method References

compressFile

Syntax

compressFile(filePath, [compressionLevel])

Details

The method compresses the input file into a .gz file and returns the file name with a suffix ".gz".

Parameters

  • filePath: A STRING scalar indicating the name and path of input file.
  • compressionLevel (optional): An integer in range [-1, 9]. The default value is -1 (equivalent to level 6). 1 gives best speed, 9 gives best compression, 0 gives no compression.

Examples

Compress /home/jccai/data.txt to /home/jccai/data.txt.gz. If a file with the same name already exists, it will be overwritten.

zlib::compressFile("/home/jccai/data.txt");

decompressFile

Syntax

decompressFile(filePath)

Details

The method compresses the input file and returns the file name.

Parameters

  • filePath: A STRING scalar indicating the name and path of input file, must end up with ".gz".

Examples

Compress /home/jccai/data.txt to /home/jccai/data.txt.gz. If a file with the same name already exists, it will be overwritten.

zlib::decompressFile("/home/jccai/data.txt.gz");

setLogLevel

Syntax

zlib::setLogLevel(logLevel)

Details

Sets the plugin's log level. The system prints plugin logs at the specified level and above. The default log level is INFO. Note that this function only sets the plugin's log level and does not change the DolphinDB server's log level.

Parameters

logLevel: The log level. Available values, in ascending order of severity, are DEBUG, INFO, WARNING, and ERROR.

Example

Set the log level of the zlib plugin to WARNING so that only WARNING and ERROR logs are output.

zlib::setLogLevel(WARNING)

getLogLevel

Syntax

zlib::getLogLevel()

Details

Returns the current log level of the plugin. The return value is a STRING scalar.