Skip to main content

extract_from_file

Function extract_from_file 

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

Reads the file at path asynchronously and runs crate::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::tokio::extract_from_file;

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