decompress method

  1. @override
Stream<Uint8List> decompress(
  1. Stream<Uint8List> input
)
override

Decompresses a stream of compressed data chunks

Takes a stream of compressed byte chunks and returns a stream of decompressed chunks. Handles format validation and checksum verification.

Example:

final input = File('large.txt.lz4').openRead();
final decompressed = codec.decompress(input);
await decompressed.pipe(File('large.txt').openWrite());

Implementation

@override
Stream<Uint8List> decompress(final Stream<Uint8List> input) {
  final limit = maxSize;
  if (limit == null) return input;
  var total = 0;
  return pumpBytes(
    input,
    onData: (final chunk, final emit) {
      total += chunk.length;
      if (total > limit) throw LimitException(limit);
      emit(chunk);
    },
    onDone: (final emit) {},
  );
}