apoc.util.decompress

Function APOC Core

apoc.util.decompress(compressed, {config}) | return a string from a compressed byte[] in various format

Signature

apoc.util.decompress(data :: LIST? OF INTEGER?, config = {} :: MAP?) :: (STRING?)

Input parameters

Name Type Default

data

LIST? OF INTEGER?

null

config

MAP?

{}

Config parameters

The procedure support the following config parameters:

Table 1. Config parameters
name type default description

compression

enum

GZIP

The compression algorithm used to decompress the byte[]
Accepted values are: GZIP, BZIP2, DEFLATE, BLOCK_LZ4, FRAMED_SNAPPY

charset

enum

UTF-8

The charset used to decompress the byte[]
Accepted values are: UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, US-ASCII, ISO-8859-1

Usage Examples

RETURN apoc.util.decompress([31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 99, 96, 96, 240, 101, 96, 96, 120, 2, 196, 37, 64, 92, 4, 196, 153, 64, 92, 1, 196, 10, 64, 236, 9, 197, 64, 118, 200, 9, 48, 102, 252, 198, 2, 228, 27, 2, 177, 17, 16, 27, 3, 0, 113, 131, 223, 46, 64, 0, 0, 0], {charset: 'UTF-32'}) AS value
Table 2. Results
value

"Mätrix II 哈哈😄123"

RETURN apoc.util.decompress([120, 156, 243, 61, 188, 164, 164, 40, 179, 66, 193, 211, 83, 225, 233, 228, 14, 32, 250, 48, 127, 70, 139, 161, 145, 49, 0, 145, 129, 11, 143], {compression: 'DEFLATE'}) AS value
Table 3. Results
value

"Mätrix II 哈哈😄123"

Return apoc.util.decompress([31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 251, 247, 159, 193, 149, 161, 130, 33, 145, 33, 151, 161, 128, 33, 135, 33, 21, 0, 9, 100, 12, 147, 16, 0, 0, 0], {charset: 'UTF-16'}) AS value
Table 4. Results
value

"Example"