Crystal bindings to XATTR.
This library allows to manage extended file attributes (XATTR). Filesystem support implemented for Linux and MacOS.
Extended attributes are name:value pairs associated permanently with files and directories and can be used to add semantic metadata, see guidelines.
Where the platform allows it, XAttr supports setting extended attributes to symlinks.
-
Add the dependency to your
shard.yml
:dependencies: xattr: github: ettomatic/xattr
-
Run
shards install
require "xattr"
xattr = XAttr.new("./myfile.txt")
xattr["user.tags"] = "mytag1,mytag2"
xattr["user.tags"]
# => "mytag1,mytag2"
xattr.keys
# => ["tags"]
xattr.to_h
# => { "tags" => "mytag1,mytag2" }
xattr.remove("user.tags")
xattr.keys
# => []
xattr["user.tags"]
# => nil
- Fork it (https://github.com/ettomatic/xattr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Ettore Berardi - creator and maintainer
- Aravinda Vishwanathapura - contributor