Skip to main content

t_binary 1.0.0 copy "t_binary: ^1.0.0" to clipboard
t_binary: ^1.0.0 copied to clipboard

TBinary is a Dart-based library designed to create a high-performance custom binary file format, capable of handling header metadata, an optional cover, multiple file entries, and large file data effi [...]

example/t_binary_example.dart

import 'dart:io';

import 'package:t_binary/t_binary.dart';

void main() async {
  try {
    final dist = Directory('dist');
    if (!dist.existsSync()) {
      await dist.create();
    }

    final res = await TBinary.readBinary('test.bin');
    print(res.header.toMap());
    print(res.fileList);
    await res.saveCover('cover.png');
    await res.extractAll(
      dist,
      onProgress: (loaded, total, message) {
        print(
          'Progress: ${((loaded / total) * 100).toStringAsFixed(2)}% - message: $message',
        );
      },
    );

    // List<String> filePaths = [
    //   '/home/than/Music/002-are-you-used-to.mpga',
    //   '/home/than/Music/test.mp4',
    //   '/home/than/Music/test.mp3',
    // ];
    // await TBinary.writeBinary(
    //   'test.bin',
    //   cover: File(
    //     '/home/than/Pictures/Untitled_logo_4_free-file.jpg',
    //   ).readAsBytesSync(),
    //   filePaths: filePaths,
    //   onProgress: (loaded, total, message) {
    //     print(
    //       'Progress: ${((loaded / total) * 100).toStringAsFixed(2)}% - message: $message',
    //     );
    //   },
    // );

    print('done');
  } catch (e) {
    print(e.toString());
  }
}
0
likes
150
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

TBinary is a Dart-based library designed to create a high-performance custom binary file format, capable of handling header metadata, an optional cover, multiple file entries, and large file data efficiently using streaming techniques.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on t_binary