xmtp_archive/importer/
file_import.rs1use super::ArchiveImporter;
2use crate::ArchiveError;
3use futures_util::io::BufReader;
4use std::{path::Path, pin::Pin};
5use tokio_util::compat::TokioAsyncReadCompatExt;
6
7impl ArchiveImporter {
8 pub async fn from_file(path: impl AsRef<Path>, key: &[u8]) -> Result<Self, ArchiveError> {
9 let reader = tokio::fs::File::open(path.as_ref()).await?;
10 let reader = BufReader::new(reader.compat());
11 let reader = Box::pin(reader) as Pin<Box<_>>;
12
13 Self::load(reader, key).await
14 }
15}