fromPath static method
Finds the PublicationFormat of the file at the given path
, using an optionally provided mimetype
.
Implementation
static PublicationFormat? fromPath(String path, {required String mimetype}) {
String? extension = p.extension(path);
if (extension.length > 1) {
// Removes the dot.
extension = extension.substring(1);
} else {
extension = null;
}
return PublicationFormat.fromMIMEType(mimetype, fileExtension: extension);
}