compressFrame method

Uint8List compressFrame(
  1. Uint8List data
)

Compression data into lz4 frame

Implementation

Uint8List compressFrame(Uint8List data) {
  final bound = getCompressFrameBound(data.length);
  final srcBuffer = data.getPointer();
  try {
    final dstBuffer = malloc.allocate<Uint8>(bound);
    final compressedLength =
        _compressFrame(dstBuffer, bound, srcBuffer, data.length);
    return dstBuffer.asTypedList(compressedLength);
  } finally {
    malloc.free(srcBuffer);
  }
}