bytepack 0.1.0 copy "bytepack: ^0.1.0" to clipboard
bytepack: ^0.1.0 copied to clipboard

BytepackCompresser is a Dart utility for efficiently encoding Map<String, dynamic> objects to bytes and compressing files with ZLib, supporting both data serialization and file compression in one package.

example/bytepack_example.dart

import 'dart:io';

import 'package:bytepack/bytepack.dart';

void main() async {
  // await compress();
  // await deCompress();
}

Future<void> deCompress() async {
  final inpFile = File('/home/than/Music/test.mp4.compressed');
  final outFile = File('/home/than/Music/test-decompress.mp4');

  final inpRaf = await inpFile.open(mode: FileMode.read);

  await BytepackCompresser.decompressFromRandomAccessFile(
    inputRaf: inpRaf,
    outputFile: outFile,
    onProgress: (progress, name) => print('progres: $progress % - name: $name'),
  );
  await inpRaf.close();
}

Future<void> compress() async {
  final file = File('/home/than/Music/test.mp4');
  final outFile = File('/home/than/Music/test.mp4.compressed');
  final outRaf = await outFile.open(mode: FileMode.write);

  await BytepackCompresser.compressRandomAccessFile(
    file: file,
    outputRaf: outRaf,
    onProgress: (progress, name) => print('progres: $progress % - name: $name'),
  );
  await outRaf.close();
}
0
likes
150
points
28
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

BytepackCompresser is a Dart utility for efficiently encoding Map<String, dynamic> objects to bytes and compressing files with ZLib, supporting both data serialization and file compression in one package.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on bytepack