fsp
fsp or file system plus is a crates that provides some function that help you to create, upload, delete files
note : this project is not complete so after updating this package check everytime if everything is compatible with the previous version
verify if a file/folder exists
he take 1 parametre :
path: the path of the folder or the file
return type :
bool
exemple :
let file_exists = file_exists;
println!;
read file
he take 1 parametre :
path: the path of the file
return type :
Result<String, io::Error>
exemple :
match read_file_content
create file
create_file()
he take 2 parametres :
content: the content of the file (string)to_path: the path of the file to put the content in, you don't need to check if the folder is created because the function already check if the folders of the output path is already created
return type :
Result<(), Box<dyn std::error::Error>>
match create_file
append content to a file
append_to_file()
he take 2 parametres :
file_path: the path of the file that you want to apopend contentcontent: the content you want tu append
return type :
io::Result<()>
exemple :
append_to_file.expect;
upload a file
for uploading a file there is 2 functions :
- upload_file_from
- upload_file_from_cb
upload_file_from()
he take 2 parametres :
from_path: the path of the file that you want to uploadto_path: the path of the file to put the content in, you don't need to check if the folder is created because the function already check if the folders of the output path is already created
return type :
Result<(), Box<dyn std::error::Error>>
exemple :
match upload_file_from
upload_file_from_cb()
he take 3 parametres :
from_path: the path of the file that you want to uploadto_path: the path of the file to put the content in, you don't need to check if the folder is created because the function already check if the folders of the output path is already createdcallback: a callback with 1 parametres, the passed parameters is a f64 and that is the progress of the downloaded file
return type :
Result<(), Box<dyn std::error::Error>>
exemple :
match upload_file_from_cb
delete a file/folder
for deleting there is 2 functions :
- delete_file
- delete_folder
- delete_fof
delete_file()
he take 1 parametres :
target_path: the path of the file
return type :
io::Result<()>
exemple :
match delete_file
//or
delete_file.expect;
delete_folder()
he take 1 parametres :
target_path: the path of the folder
return type :
io::Result<()>
exemple :
match delete_folder
//or
delete_folder.expect;
delete_fof() (fof = file or folder)
he take 1 parametres :
target_path: the path of the folder or the folder
return type :
io::Result<()>
exemple :
match delete_fof
//or
delete_fof.expect;