xattr v0.6.1

Crystal bindings for XATTR

XAttr

Build Status

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.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      xattr:
        github: ettomatic/xattr
    
  2. Run shards install

Usage

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

Contributing

  1. Fork it (https://github.com/ettomatic/xattr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

xattr

Owner
Statistic
  • 8
  • 2
  • 2
  • 0
  • 0
  • over 3 years ago
  • June 15, 2020
License

MIT License

Links
Synced at

Thu, 21 Nov 2024 13:43:54 GMT

Languages