[−][src]Struct mfs::Mfs
The main struct
All of its functions will panic if the passed paths are not valid unicode.
Fields
hash_default: String
Default hash function to use for write / create operations.
cid_default: i32
Default cid version to request on write / create operations. Defaults to 1
.
raw_leaves_default: bool
Whether to write files with raw-leaves
Implementations
impl Mfs
[src]
pub fn new(api: &str) -> Result<Mfs, InvalidUri>
[src]
pub async fn rm_r<P: AsRef<Path>, '_>(&'_ self, p: P) -> Result<(), MfsError>
[src]
Remove file or folder (possibly non-empty)
pub async fn rm<P: AsRef<Path>, '_>(&'_ self, p: P) -> Result<(), MfsError>
[src]
Remove file
pub async fn mkdirs<P: AsRef<Path>, '_>(&'_ self, p: P) -> Result<(), MfsError>
[src]
Create directory p
and parents as needed.
pub async fn mkdir<P: AsRef<Path>, '_>(&'_ self, p: P) -> Result<(), MfsError>
[src]
Create directory p
. Requires that its parent already exist.
pub async fn mv<PS: AsRef<Path>, PD: AsRef<Path>, '_>(
&'_ self,
s: PS,
d: PD
) -> Result<(), MfsError>
[src]
&'_ self,
s: PS,
d: PD
) -> Result<(), MfsError>
Rename / move s
to d
.
pub async fn cp<PS: AsRef<Path>, PD: AsRef<Path>, '_>(
&'_ self,
s: PS,
d: PD
) -> Result<(), MfsError>
[src]
&'_ self,
s: PS,
d: PD
) -> Result<(), MfsError>
Copy path s
to path d
. Beware of s
starting with /ipfs
or /ipns
.
pub async fn ls<P: AsRef<Path>, '_>(
&'_ self,
p: P
) -> Result<Vec<PathBuf>, MfsError>
[src]
&'_ self,
p: P
) -> Result<Vec<PathBuf>, MfsError>
List files in folder
pub fn get<'a, P: AsRef<Path>>(
&self,
s: P
) -> impl Stream<Item = Result<Bytes, MfsError>>
[src]
&self,
s: P
) -> impl Stream<Item = Result<Bytes, MfsError>>
Read file at s
.
pub async fn get_fully<P: AsRef<Path>, '_>(
&'_ self,
s: P
) -> Result<Vec<u8>, MfsError>
[src]
&'_ self,
s: P
) -> Result<Vec<u8>, MfsError>
Read file at s
into in-memory buffer.
pub async fn flush<P: AsRef<Path>, '_>(&'_ self, p: P) -> Result<(), MfsError>
[src]
Flush folder
pub async fn put<P: AsRef<Path>, R: 'static + AsyncRead + Send + Sync + Unpin, '_>(
&'_ self,
d: P,
__arg2: R
) -> Result<(), MfsError>
[src]
&'_ self,
d: P,
__arg2: R
) -> Result<(), MfsError>
Write file to d
.
Internally buffers chunks of 8 MiB and writes them with separate calls to IPFS
due to limitations of multipart
.
pub async fn stat<P: AsRef<Path>, '_>(
&'_ self,
p: P
) -> Result<Option<FilesStatResponse>, MfsError>
[src]
&'_ self,
p: P
) -> Result<Option<FilesStatResponse>, MfsError>
Request hash, type, sizes, and block count of p
. Returns None
if the file does not exist
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Mfs
impl Send for Mfs
impl Sync for Mfs
impl Unpin for Mfs
impl !UnwindSafe for Mfs
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,