mime 2.0.0 copy "mime: ^2.0.0" to clipboard
mime: ^2.0.0 copied to clipboard

Utilities for handling media (MIME) types, including determining a type from a file extension and file contents.

example/example.dart

// 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
}
495
likes
160
points
6.23M
downloads

Publisher

verified publishertools.dart.dev

Weekly Downloads

Utilities for handling media (MIME) types, including determining a type from a file extension and file contents.

Repository (GitHub)
View/report issues
Contributing

Topics

#magic-numbers #mime #mimetype #multipart-form

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on mime