Add example, fix readme
diff --git a/README.md b/README.md
index 4c8f313..fc82c25 100644
--- a/README.md
+++ b/README.md
@@ -14,9 +14,18 @@
the most common file name extensions and magic bytes registered.
```dart
-print(lookupMimeType('test.html')); // Will print text/html
-print(lookupMimeType('test', [0xFF, 0xD8])); // Will print image/jpeg
-print(lookupMimeType('test.html', [0xFF, 0xD8])); // Will print image/jpeg
+import 'package:mime/mime.dart';
+
+void main() {
+ print(lookupMimeType('test.html'));
+ // text/html
+
+ print(lookupMimeType('test', headerBytes: [0xFF, 0xD8]));
+ // image/jpeg
+
+ print(lookupMimeType('test.html', headerBytes: [0xFF, 0xD8]));
+ // image/jpeg
+}
```
You can build you own resolver by creating an instance of
diff --git a/example/example.dart b/example/example.dart
new file mode 100644
index 0000000..af14cb0
--- /dev/null
+++ b/example/example.dart
@@ -0,0 +1,12 @@
+import 'package:mime/mime.dart';
+
+void main() {
+ print(lookupMimeType('test.html'));
+ // text/html
+
+ print(lookupMimeType('test', headerBytes: [0xFF, 0xD8]));
+ // image/jpeg
+
+ print(lookupMimeType('test.html', headerBytes: [0xFF, 0xD8]));
+ // image/jpeg
+}