apoc.util.decompress

Details

Syntax

apoc.util.decompress(data [, config ])

Description

Unzips the given byte array.

Arguments

Name

Type

Description

data

BYTEARRAY

The bytearray of data to decompress.

config

MAP

{ compression = "GZIP" :: ["GZIP", "BZIP2", "DEFLATE", "BLOCK_LZ4", "FRAMED_SNAPPY", "NONE"], charset = "UTF_8" ::["UTF-8", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-32", "US-ASCII", "ISO-8859-1"] } The default is: {}.

Returns

STRING

Config parameters

The procedure support the following config parameters:

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, NONE (that is conversion to string without compression)

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

WITH apoc.util.compress("Mätrix II 哈哈😄123", {charset: 'UTF-32'}) as compressed
RETURN apoc.util.decompress(compressed, {charset: 'UTF-32'}) AS value
Results
value

"Mätrix II 哈哈😄123"

WITH apoc.util.compress("Mätrix II 哈哈😄123", {compression: 'DEFLATE'}) as compressed
RETURN apoc.util.decompress(compressed, {compression: 'DEFLATE'}) AS value
Results
value

"Mätrix II 哈哈😄123"

WITH apoc.util.compress("Example", {charset: 'UTF-16'}) as compressed
RETURN apoc.util.decompress(compressed, {charset: 'UTF-16'}) AS value
Results
value

"Example"