Skip to main content

extract_from_file

Function extract_from_file 

Source
pub fn extract_from_file<P: AsRef<Path>>(
    path: P,
) -> Result<(MetadataMap, Keywords, MetaTagGroups), MetadataError>
Available on crate feature std only.
Expand description

Reads the file at path and runs extract_and_prepare_metadata.

§Errors

As extract_from_reader.

§Security

path is opened as given. Validate a path that comes from untrusted input before passing it, to rule out path traversal.

§Example

use metadata_gen::io::extract_from_file;

let (metadata, keywords, tags) = extract_from_file("content/post.md").unwrap();