Skip to content

mvo5/libsmbclient-go

Repository files navigation

Go Bindings for libsmbclient

PkgGoDev Tests report Go Report Card License

Bindings (read-only for now) for the libsmbclient library from samba. To compile on debian/ubuntu install the "libsmbclient-dev" package.

Build it with:

$ go build ./cmd/smb
$ ./smb -show-dir smb://localhost

Check main.go for a code example.

Limitation:

The C libsmbclient from samba is not thread safe, so all go smbclient.Client/smbclient.File operations are serialized (i.e. there can only be one operation at a time for each Client/File). As a workaround you should create one smbclient.Client per goroutine.

Example usage:

import (
       "fmt"

       "github.com/mvo5/libsmbclient-go"
)

client := smbclient.New()
dh, err := client.Opendir("smb://localhost")
if err != nil {
    return err
}
defer dh.Closedir()
for {
    dirent, err := dh.Readdir()
    if err != nil {
       break
    }
    fmt.Println(dirent)
}

About

Go bindings for libsmbclient

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •