GithubHelp home page GithubHelp logo

remotefs-rs-smb's Introduction

remotefs SMB

Changelog · Get started · Documentation

~ Remotefs SMB client ~

Developed by @veeso

Current version: 0.2.1 (15/12/2023)

License-MIT Repo stars Downloads counter Latest version Ko-fi

Linux CI MacOS CI Windows CI Coveralls Docs


About remotefs-smb ☁️

remotefs-smb is a client implementation for remotefs, providing support for the SMB protocol.


Get started 🚀

First of all, add remotefs-smb to your project dependencies:

remotefs-smb = "^0.2"

these features are supported:

  • find: enable find() method on client (enabled by default)
  • no-log: disable logging. By default, this library will log via the log crate.

Install dependencies (UNIX based only)

remotefs-smb relies on pavao, which requires the libsmbclient library, which can be installed with the following instructions:

MacOS 🍎

Install samba with brew:

brew install samba

Debian based systems 🐧

Install libsmbclient with apt:

apt install -y libsmbclient-dev libsmbclient

⚠️ libsmbclient-dev is required only on the machine where you build the application

RedHat based systems 🐧

Install libsmbclient with dnf:

dnf install libsmbclient-devel libsmbclient

⚠️ libsmbclient-devel is required only on the machine where you build the application

Build from sources 📁

Install libsmbclient building from sources:

wget -O samba.tar.gz https://github.com/samba-team/samba/archive/refs/tags/samba-4.16.1.tar.gz
mkdir -p samba/
tar  xzvf samba.tar.gz -C samba/ --strip-components=1
rm samba.tar.gz
cd samba/
./configure
make
make install
cd ..
rm -rf samba/

Client implementation

UNIX client

// import remotefs trait and client
use remotefs::{RemoteFs, fs::UnixPex};
use remotefs_smb::{SmbFs, SmbOptions, SmbCredentials};
use std::path::Path;
let mut client = SmbFs::try_new(
    SmbCredentials::default()
        .server("smb://localhost:3445")
        .share("/temp")
        .username("test")
        .password("test")
        .workgroup("pavao"),
    SmbOptions::default()
        .case_sensitive(true)
        .one_share_per_server(true),
)
.unwrap();
// connect
assert!(client.connect().is_ok());
// get working directory
println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
// make directory
assert!(client.create_dir(Path::new("/cargo"), UnixPex::from(0o755)).is_ok());
// change working directory
assert!(client.change_dir(Path::new("/cargo")).is_ok());
// disconnect
assert!(client.disconnect().is_ok());

Windows client

// import remotefs trait and client
use remotefs::{RemoteFs, fs::UnixPex};
use remotefs_smb::{SmbFs, SmbCredentials};
use std::path::Path;
let mut client = SmbFs::new(
    SmbCredentials::new("localhost:3445", "temp")
        .username("test")
        .password("test")
);
// connect
assert!(client.connect().is_ok());
// get working directory
println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
// make directory
assert!(client.create_dir(Path::new("\\cargo"), UnixPex::from(0o755)).is_ok());
// change working directory
assert!(client.change_dir(Path::new("\\cargo")).is_ok());
// disconnect
assert!(client.disconnect().is_ok());

Client compatibility table ✔️

The following table states the compatibility for the client client and the remote file system trait method.

Note: connect(), disconnect() and is_connected() MUST always be supported, and are so omitted in the table.

Client/Method Support (UNIX) Support (Win )
append_file Yes Yes
append No Yes
change_dir Yes Yes
copy No Yes
create_dir Yes Yes
create_file Yes Yes
create No Yes
exec No No
exists Yes Yes
list_dir Yes Yes
mov Yes Yes
open_file Yes Yes
open No Yes
pwd Yes Yes
remove_dir_all Yes Yes
remove_dir Yes Yes
remove_file Yes Yes
setstat No Yes
stat Yes Yes
symlink Yes Yes

Support the developer ☕

If you like remotefs-smb and you're grateful for the work I've done, please consider a little donation 🥳

You can make a donation with one of these platforms:

ko-fi PayPal


Contributing and issues 🤝🏻

Contributions, bug reports, new features, and questions are welcome! 😉 If you have any questions or concerns, or you want to suggest a new feature, or you want just want to improve remotefs, feel free to open an issue or a PR.

Please follow our contributing guidelines


Changelog ⏳

View remotefs' changelog HERE


Powered by 💪

remotefs-smb is powered by these aweseome projects:


License 📃

remotefs-smb is licensed under the MIT license.

You can read the entire license HERE

remotefs-rs-smb's People

Contributors

talha avatar veeso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

talha

remotefs-rs-smb's Issues

can't link to windows

hi,when i want to run the examples with windows , the new() functions is not be found in this crates, in release 0.2.21 version. need your help. think you

Relation to pavao?

So is it correct that this library depends on pavão?

I'm developing primarily for Windows at the moment, so it seems like this is the crate to use for connecting to SMB shares, as pavão does not appear to support Windows?

Thanks

can't link to windows

hi,when i want to run the examples with windows , the new() functions is not be found in this crates, in release 0.2.21 version. need your help. think you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.