https://github.com/petoem/inotify.cr
Inotify bindings for Crystal
https://github.com/petoem/inotify.cr
bindings crystal inotify
Last synced: 2 months ago
JSON representation
Inotify bindings for Crystal
- Host: GitHub
- URL: https://github.com/petoem/inotify.cr
- Owner: petoem
- License: mit
- Created: 2017-07-28T14:40:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-09-04T17:46:49.000Z (7 months ago)
- Last Synced: 2025-09-04T18:11:42.557Z (7 months ago)
- Topics: bindings, crystal, inotify
- Language: Crystal
- Size: 97.7 KB
- Stars: 40
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inotify
Inotify bindings for [Crystal language](https://github.com/crystal-lang/crystal).
[](https://github.com/petoem/inotify.cr/releases)
[](https://github.com/petoem/inotify.cr/actions/workflows/crystal.yml)
[](https://github.com/petoem/inotify.cr/blob/master/LICENSE)
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
inotify:
github: petoem/inotify.cr
version: 1.2.0
```
## Usage
```crystal
require "inotify"
# To watch a file or directory ...
watcher = Inotify.watch "/path/to/file.txt" do |event|
# your awesome logic
end
# ... for 10 seconds.
sleep 10.seconds
watcher.close
```
_Note: You have to run something in the main fiber or else your program will exit._
More documentation can be found [here](https://petoem.github.io/inotify.cr/).
## Development
To enable logging to `STDOUT` using environment variables, follow the instructions in the [api docs](https://crystal-lang.org/api/0.34.0/Log.html#configure-logging-from-environment-variables). Use log source `inotify` and severity level `DEBUG`.
## Contributing
1. [Fork it!](https://github.com/petoem/inotify.cr/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
- [petoem](https://github.com/petoem) Michael Petö - creator, maintainer