mime 2.0.0 mime: ^2.0.0 copied to clipboard
Utilities for handling media (MIME) types, including determining a type from a file extension and file contents.
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
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
}