compress method

  1. @override
Uint8List compress(
  1. Uint8List data
)
override

Compress data synchronously

Takes a byte array and returns compressed data. The entire input must fit in memory. For large data, consider using streaming APIs.

Implementation

@override
Uint8List compress(final Uint8List data) {
  final encoder = Lz4Encoder(
    level: level,
    blockSize: blockSize,
    checksum: checksum,
  );
  return switch (format) {
    Lz4Format.frame => encoder.compress(data),
    Lz4Format.raw => encoder.compressBlock(data),
    Lz4Format.hadoop => encoder.compressHadoop(data),
  };
}