https://github.com/software-mansion-labs/elixir-xattr
Elixir library for accessing and manipulating custom extended filesystem attributes
https://github.com/software-mansion-labs/elixir-xattr
elixir xattr
Last synced: 2 months ago
JSON representation
Elixir library for accessing and manipulating custom extended filesystem attributes
- Host: GitHub
- URL: https://github.com/software-mansion-labs/elixir-xattr
- Owner: software-mansion-labs
- License: mit
- Created: 2017-07-14T08:22:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-16T22:02:28.000Z (over 4 years ago)
- Last Synced: 2025-02-03T12:48:25.245Z (4 months ago)
- Topics: elixir, xattr
- Language: C
- Homepage: https://hex.pm/packages/xattr
- Size: 43 KB
- Stars: 1
- Watchers: 11
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Elixir Xattr
[](https://hex.pm/packages/xattr)
[](https://hexdocs.pm/xattr/)A library for accessing and manipulating **custom** [extended filesystem attributes](https://en.wikipedia.org/wiki/Extended_file_attributes). Main goals are to provide straightforward API and portability, both Windows (ADS) and Unix (xattr) platforms are supported.
This library doesn't aim to be general extended filesystem attributes library, because implementation details greately differ between supported platforms. Rather, it focuses on providing portable way for client application to store and read some metadata in files. Attributes are stored in isolation, in *xattr* backend in `user.ElixirXattr` namespace and in *Windows* backend in `ElixirXattr` data stream. For details see *Implementation* section in module docs.
## Example
```elixir
iex(1)> File.touch!("foo.txt")
:ok
iex(2)> Xattr.set("foo.txt", "hello", "world")
:ok
iex(3)> Xattr.get("foo.txt", "hello")
{:ok, "world"}
iex(4)> Xattr.set("foo.txt", :atoms_also_work, "bar")
:ok
iex(5)> Xattr.ls("foo.txt")
{:ok, ["hello", :atoms_also_work]}
iex(6)> Xattr.rm("foo.txt", "hello")
:ok
iex(7)> Xattr.ls("foo.txt")
{:ok, [:atoms_also_work]}
```## Installation
The package can be installed by adding `xattr` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:xattr, "~> 0.3"}]
end
```## License
See the [LICENSE] file for license rights and limitations (MIT).
[LICENSE]: https://github.com/SoftwareMansion/elixir-xattr/blob/master/LICENSE.txt