Last updated:
0 purchases
file type checker
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.
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()}')
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.