file_type_checker 0.0.1+2 copy "file_type_checker: ^0.0.1+2" to clipboard
file_type_checker: ^0.0.1+2 copied to clipboard

File Signature Matcher written in Dart ~

File Type Matcher #

File Signature Matcher written in Dart can be used to determine file type from its byte array. It's useful when you cannot rely on the file extension to determine the file type.

About #

file_signature is a Flutter package that can match specific file extension from a file's byte stream.

example

Sample Code #

  final uri = Uri.parse($_YOUR_URL);
  late http.Response response;
  try {
    response = await http.get(uri);
  } catch (e) {
    // TODO: Handle Exceptions
  } finally {
    final bytes = response.bodyBytes;
    final matcher = FileSignatureMatcher();
    final List<FileExtension>? matchedExtensions = matcher.getFileExtension(headerBytes: bytes);
    // Some file formats shares the same extensions, such as doc and docx
    debugPrint('Matched extensions: ${matchedExtensions.toString()}')
  }   
6
likes
120
points
0
downloads

Publisher

verified publisherexabyting.com

Weekly Downloads

File Signature Matcher written in Dart ~

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on file_type_checker