FileManager

Struct FileManager 

Source
pub struct FileManager<'a> { /* private fields */ }
Expand description

File manager for sandbox file operations

Implementations§

Source§

impl<'a> FileManager<'a>

Source

pub fn new(client: &'a DaytonaClient) -> Self

Create a new file manager

Source

pub async fn upload( &self, sandbox_id: &Uuid, path: &str, content: &[u8], ) -> Result<()>

Upload a file to the sandbox

Source

pub async fn upload_text( &self, sandbox_id: &Uuid, path: &str, content: &str, ) -> Result<()>

Upload text content as a file

Source

pub async fn download(&self, sandbox_id: &Uuid, path: &str) -> Result<Vec<u8>>

Download a file from the sandbox

Source

pub async fn download_text( &self, sandbox_id: &Uuid, path: &str, ) -> Result<String>

Download a text file from the sandbox

Source

pub async fn delete(&self, sandbox_id: &Uuid, path: &str) -> Result<()>

Delete a file from the sandbox

Source

pub async fn list(&self, sandbox_id: &Uuid, path: &str) -> Result<Vec<FileInfo>>

List files in a directory

Source

pub async fn get_file_info( &self, sandbox_id: &Uuid, path: &str, ) -> Result<FileInfo>

Get file information

Source

pub async fn exists(&self, sandbox_id: &Uuid, path: &str) -> Result<bool>

Check if a file exists

Source

pub async fn create_directory( &self, sandbox_id: &Uuid, path: &str, ) -> Result<()>

Create a directory

Source

pub async fn copy( &self, sandbox_id: &Uuid, source: &str, destination: &str, ) -> Result<()>

Copy a file within the sandbox

Source

pub async fn rename( &self, sandbox_id: &Uuid, source: &str, destination: &str, ) -> Result<()>

Move/rename a file within the sandbox

Source

pub async fn find_in_files( &self, sandbox_id: &Uuid, pattern: &str, path: &str, ) -> Result<Vec<FindResult>>

Find text in files

Source

pub async fn replace_in_files( &self, sandbox_id: &Uuid, find: &str, replace: &str, files: &[String], ) -> Result<Vec<String>>

Replace text in files

Source

pub async fn search_files( &self, sandbox_id: &Uuid, pattern: &str, path: &str, ) -> Result<Vec<String>>

Search for files by name pattern

Source

pub async fn set_file_permissions( &self, sandbox_id: &Uuid, path: &str, mode: &str, owner: Option<&str>, group: Option<&str>, ) -> Result<()>

Set file permissions

Auto Trait Implementations§

§

impl<'a> Freeze for FileManager<'a>

§

impl<'a> !RefUnwindSafe for FileManager<'a>

§

impl<'a> Send for FileManager<'a>

§

impl<'a> Sync for FileManager<'a>

§

impl<'a> Unpin for FileManager<'a>

§

impl<'a> !UnwindSafe for FileManager<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,