Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I detect if a file is binary (non-text) in dart?

In a dart console application, how can I tell if a file is binary (non-text)?

like image 253
Kasper Avatar asked Dec 05 '25 03:12

Kasper


1 Answers

Read the file content and check if you find non-displayable characters. An example would be \u0000 or consecutive \u0000, which often occurs in binary files but not in text files.

See also How can I determine if a file is binary or text in c#?, https://stackoverflow.com/a/277568/217408

like image 66
Günter Zöchbauer Avatar answered Dec 08 '25 01:12

Günter Zöchbauer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!