CBFS Storage 2020 .NET Edition

Questions / Feedback?

SetFileCompression Method

Compresses or decompresses a file or alternate stream.

Syntax

public void SetFileCompression(string fileName, int compression, int compressionLevel, int pagesPerBlock, string password);
Public Sub SetFileCompression(ByVal FileName As String, ByVal Compression As Integer, ByVal CompressionLevel As Integer, ByVal PagesPerBlock As Integer, ByVal Password As String)

Remarks

This method changes the compression mode used to compress the file or alternate stream specified by FileName.

The value passed for FileName must be a vault-local absolute path.

The Compression parameter specifies the new compression mode to use. Valid values are:

CBFSSTORAGE_CM_NONE0Don't use compression.

CBFSSTORAGE_CM_DEFAULT1Use default compression (zlib).

CBFSSTORAGE_CM_CUSTOM2Use event-based custom compression.

Compression level is not used.

CBFSSTORAGE_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

CBFSSTORAGE_CM_RLE4Use RLE compression.

Compression level is not used.

Applications that use custom compression must the DataCompress and DataDecompress events. Please refer to the Compression topic for more information.

The CompressionLevel parameter specifies the compression level to use, if applicable.

The PagesPerBlock parameter specifies how many pages should be compressed as a single block, if applicable. Valid values are powers of 2 up to and including 128 (i.e., 2, 4, 8, 16, 32, 64, or 128); or 0, which is interpreted as "default" (currently 16 for both zlib and RLE). Larger values allow for more efficient compression; however, since a block must be decompressed (and, for writes, recompressed) anytime its data is accessed, larger values can also cause excessive slowdown, especially for random access.

The Password parameter specifies the password to use to access the file's data, if it is encrypted.

Note: This method can only be called when Active is true, and cannot be called within events.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Storage 2020 .NET Edition - Version 20.0 [Build 8031]