{"id":22942313,"url":"https://github.com/shengaero/komodo","last_synced_at":"2025-07-08T12:03:28.275Z","repository":{"id":47512240,"uuid":"171367729","full_name":"Shengaero/komodo","owner":"Shengaero","description":"A simple file watcher library for Java and Kotlin applications.","archived":false,"fork":false,"pushed_at":"2022-11-03T19:32:50.000Z","size":75,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-10T16:44:43.955Z","etag":null,"topics":["file-system","file-watchers","java","kotlin","kotlin-coroutines"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shengaero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-18T22:50:26.000Z","updated_at":"2023-02-21T11:26:20.000Z","dependencies_parsed_at":"2023-01-20T23:17:02.377Z","dependency_job_id":null,"html_url":"https://github.com/Shengaero/komodo","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shengaero%2Fkomodo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shengaero%2Fkomodo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shengaero%2Fkomodo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shengaero%2Fkomodo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shengaero","download_url":"https://codeload.github.com/Shengaero/komodo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229710746,"owners_count":18111641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-system","file-watchers","java","kotlin","kotlin-coroutines"],"created_at":"2024-12-14T13:47:22.836Z","updated_at":"2024-12-14T13:47:23.424Z","avatar_url":"https://github.com/Shengaero.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[license]: https://img.shields.io/badge/License-Apache-red.svg?style=flat-square\n\n[ ![license][] ](https://github.com/Shengaero/komodo/blob/master/LICENSE)\n\n# Komodo\n\nA simple JVM library for watching files.\n\n## Usage and Examples\n\nKomodo makes it easy to watch files on the JVM in Java or Kotlin!\n\n```kotlin\nprivate val baseDir = File(System.getProperty(\"user.dir\"))\n\n// A simple kotlin program using Komodo.\n// Run in a directory to watch the directory for the next file-system event.\nfun main(args: Array\u003cString\u003e) {\n    val watcher = FileWatcher(baseDir) {\n        // enabled which events to watch for using the configuration closure!\n        watchCreations = true\n        watchModifications = true\n        watchDeletions = true\n    }\n\n    while(true) {\n        val event = watcher.poll() ?: continue\n        println(\"File event received! Type: ${event.type}. Path: '${event.file}'.\")\n        break\n    }\n\n    watcher.close()\n\n    println(\"End program...\")\n}\n```\n\nKomodo is written in Kotlin, but is Java friendly, and can be used from normal Java code with ease!\n\n```java\n// A simple java program using Komodo.\n// Run in a directory to watch the directory for the next file-system event.\npublic class Main {\n    private static final File BASE_DIR = new File(System.getProperty(\"user.dir\"));\n    \n    public static void main(String[] args)\n    {\n        FileWatcher.Config config = new FileWatcher.Config();\n\n        config.setWatchCreations(true);\n        config.setWatchModifications(true);\n        config.setWatchDeletions(true);\n\n        FileWatcher watcher = FileWatchers.create(BASE_DIR, config);\n\n        while(true)\n        {\n            FileEvent event = watcher.poll();\n            if(event == null) continue;\n            System.out.println(\"File event received! Type: \" + event.getType().toString() + \". Path: '\" + event.getFile().toString() + \"'.\");\n            break;\n        }\n\n        watcher.close();\n\n        System.out.println(\"End program...\");\n    }\n}\n```\n\nThere is also a module that has [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) integration!\n\n```kotlin\nprivate val baseDir = File(System.getProperty(\"user.dir\"))\n\n// A simple kotlin program using Komodo with coroutines.\n// Run in a directory to watch the directory for the next file-system event.\nfun main(args: Array\u003cString\u003e) = runBlocking {\n    val watcher = watch(baseDir) {\n        watchCreations = true\n        watchModifications = true\n        watchDeletions = true\n    }\n\n    val event = watcher.receive()\n\n    println(\"File event received! Type: ${event.type}. Path: '${event.file}'.\")\n\n    watcher.close()\n\n    println(\"End program...\")\n}\n```\n\n## License\n\nKomodo is licensed under the [Apache 2.0 License](https://github.com/Shengaero/komodo/blob/master/LICENSE)\n\n```\n   Copyright 2018 Kaidan Gustave\n   \n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n   \n       http://www.apache.org/licenses/LICENSE-2.0\n   \n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshengaero%2Fkomodo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshengaero%2Fkomodo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshengaero%2Fkomodo/lists"}