Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rubiojr/go-udisks
Linux UDisks2 (dbus) easy access from Go
https://github.com/rubiojr/go-udisks
dbus udisks2
Last synced: about 1 month ago
JSON representation
Linux UDisks2 (dbus) easy access from Go
- Host: GitHub
- URL: https://github.com/rubiojr/go-udisks
- Owner: rubiojr
- License: mit
- Created: 2022-04-23T14:49:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-10T11:44:01.000Z (over 2 years ago)
- Last Synced: 2024-06-20T03:57:30.934Z (7 months ago)
- Topics: dbus, udisks2
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# udisks
udisks gives you high level access to Linux system drives and block devices wrapping the [udisk2](http://storaged.org/doc/udisks2-api/) interfaces.
An example command line `udisks` client to list drives and block device properties can be installed with:
```
go install github.com/rubiojr/go-udisks/cmd/udisks@latest
``````Go
package mainimport (
"encoding/json"
"fmt""os"
"github.com/rubiojr/go-udisks"
)func main() {
client, err := udisks.NewClient()
if err != nil {
panic(err)
}// List all block devices available to UDisks2
devs, err := client.BlockDevices()
if err != nil {
panic(err)
}
pretty(devs)
}func pretty(dev interface{}) {
prettyString, _ := json.MarshalIndent(dev, "", " ")
fmt.Println(string(prettyString))
}