All Projects → GianniCarlo → DirectoryWatcher

GianniCarlo / DirectoryWatcher

Licence: MIT license
LIstener for changes in a specified folder

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to DirectoryWatcher

vue-scrollwatch
scrollspy
Stars: ✭ 59 (+78.79%)
Mutual labels:  watcher
Swatch
Watcher for Unit Tests written in Swift
Stars: ✭ 55 (+66.67%)
Mutual labels:  watcher
AppListManager
📱 AppListManager (Android Library) makes managing application and activity lists easy.
Stars: ✭ 59 (+78.79%)
Mutual labels:  listener
midi-eye
Ruby MIDI input event listener
Stars: ✭ 24 (-27.27%)
Mutual labels:  listener
pwatch
Process watcher(pwatch)
Stars: ✭ 33 (+0%)
Mutual labels:  watcher
packetevents
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. We support many protocol versions. (1.8+)
Stars: ✭ 235 (+612.12%)
Mutual labels:  listener
gowatch
watch go files for developer, support run test case and auto reload server application
Stars: ✭ 18 (-45.45%)
Mutual labels:  watcher
arelo
a simple auto reload (live reload) utility
Stars: ✭ 54 (+63.64%)
Mutual labels:  watcher
watcherd
A shell daemon that will listen for directory changes and execute custom commands for each event.
Stars: ✭ 48 (+45.45%)
Mutual labels:  watcher
BackToMe
Little tool made in python to create payloads for Linux, Windows and OSX with unique handler
Stars: ✭ 61 (+84.85%)
Mutual labels:  listener
rorshach
A watchman for your directories. Rorshach allows you to listen to file system changes and run commands when these events occur.
Stars: ✭ 26 (-21.21%)
Mutual labels:  watcher
GPSd4Java
GPSd client library written in Java
Stars: ✭ 40 (+21.21%)
Mutual labels:  listener
chokidar-socket-emitter
a simple chokidar watcher which emits events to all connected socket.io clients
Stars: ✭ 28 (-15.15%)
Mutual labels:  watcher
jetty-load-generator
jetty-project.github.io/jetty-load-generator/
Stars: ✭ 62 (+87.88%)
Mutual labels:  listener
react-bottom-scroll-listener
A simple listener component that invokes a callback when the webpage is scrolled to the bottom.
Stars: ✭ 129 (+290.91%)
Mutual labels:  listener
react-native-android-notification-listener
React Native Android Notification Listener - Listen for status bar notifications from all applications
Stars: ✭ 87 (+163.64%)
Mutual labels:  listener
spydriver
🕵️ Lightweight utility to intercept WebDriver and WebElement method calls.
Stars: ✭ 24 (-27.27%)
Mutual labels:  listener
SwiftFSWatcher
A simple easy to use / extend File System watcher using Swift
Stars: ✭ 35 (+6.06%)
Mutual labels:  watcher
meerkat
Watch your following activities on Instagram.
Stars: ✭ 31 (-6.06%)
Mutual labels:  watcher
Flask-Validator
Validator for SQLAlchemy Models
Stars: ✭ 27 (-18.18%)
Mutual labels:  listener

This is a Swift translation of the Objective C version. Took some inspiration from this repo as well

DirectoryWatcher

DirectoryWatcher is a lightweight class that uses GCD to monitor a given path for changes. When any change to the directory occurs, DirectoryWatcher starts polling the monitored path, making sure that file transfers are finished before posting notifications.

Installing

CocoaPods (recommended)

# For latest release in cocoapods
pod 'DirectoryWatcher'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate DirectoryWatcher into your Xcode project using Carthage, specify it in your Cartfile:

github "GianniCarlo/DirectoryWatcher" ~> 2.0.0

Run carthage update to build the framework and drag the built DirectoryWatcher.framework into your Xcode project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding DirectoryWatcher as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
	.package(url: "https://github.com/GianniCarlo/DirectoryWatcher.git", .upToNextMajor(from: "2.7.0"))
]

Usage (DirectoryWatcher)

Monitor the Documents Folder

let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let watcher = DirectoryWatcher.watch(documentsUrl)

watcher.onNewFiles = { newFiles in
  // Files have been added
}

watcher.onDeletedFiles = { deletedFiles in
  // Files have been deleted
}

Call watcher.stopWatching() and watcher.startWatching() to pause / resume.

Usage (DirectoryDeepWatcher)

Monitor the Documents Folder and its subfolders

let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let watcher = DirectoryDeepWatcher.watch(documentsUrl)

watcher.onFolderNotification = { folder in
  // New changes have happened inside one folder
  // This folder could be a subfolder inside the root folder being watched
}

Call watcher.stopWatching() and watcher.startWatching() to pause / resume, or watcher.restartWatching() to discard previous listeners and place new ones in case the hierarchy has changed

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].