All Projects → eonil → FSEvents

eonil / FSEvents

Licence: MIT license
An unofficial wrapper around FSEvent tailored for Swift 5.

Programming Languages

swift
15916 projects
shell
77523 projects

Projects that are alternatives of or similar to FSEvents

Chokidar
Minimal and efficient cross-platform file watching library
Stars: ✭ 8,538 (+10572.5%)
Mutual labels:  filesystem, fsevents
fat32
[New Version] This is FAT32 FileSystem Library, which is #![no_std] and does not use alloc.
Stars: ✭ 25 (-68.75%)
Mutual labels:  filesystem
btcfs
Use the blockchain as a filesystem in Plan9
Stars: ✭ 20 (-75%)
Mutual labels:  filesystem
gcsfs
Google Cloud Storage filesystem for PyFilesystem2
Stars: ✭ 36 (-55%)
Mutual labels:  filesystem
management tools
A collection of scripts and packages to simplify OS X management.
Stars: ✭ 93 (+16.25%)
Mutual labels:  filesystem
ansible-role-glusterfs
Ansible Role - GlusterFS
Stars: ✭ 95 (+18.75%)
Mutual labels:  filesystem
fuse-nfs-crossbuild-scripts
fuse-nfs for windows using dokany
Stars: ✭ 35 (-56.25%)
Mutual labels:  filesystem
encfs4win
Windows port of EncFS
Stars: ✭ 356 (+345%)
Mutual labels:  filesystem
vk-music-fs
FUSE file system for VK audios
Stars: ✭ 34 (-57.5%)
Mutual labels:  filesystem
MeowDB.js
Database in JSON (Node.JS Library)
Stars: ✭ 12 (-85%)
Mutual labels:  filesystem
apfs
Package apfs implements an Apple File System(apfs) bindings for Go
Stars: ✭ 30 (-62.5%)
Mutual labels:  filesystem
toolkit
some useful library of the php
Stars: ✭ 15 (-81.25%)
Mutual labels:  filesystem
ModernOperatingSystems AndrewTanenbaum
My notes after reading 'Modern Operating Systems' book by Andrew Tanenbaum and Herbert Bos.
Stars: ✭ 71 (-11.25%)
Mutual labels:  filesystem
output-file-sync
Synchronously write a file and create its ancestor directories if needed
Stars: ✭ 14 (-82.5%)
Mutual labels:  filesystem
exuberant
React filesystem renderer
Stars: ✭ 52 (-35%)
Mutual labels:  filesystem
chokidar-socket-emitter
a simple chokidar watcher which emits events to all connected socket.io clients
Stars: ✭ 28 (-65%)
Mutual labels:  filesystem
cache
🥌 Deno cache library
Stars: ✭ 38 (-52.5%)
Mutual labels:  filesystem
cpmtools
Tools to access CP/M file systems (forked)
Stars: ✭ 29 (-63.75%)
Mutual labels:  filesystem
sandboxed-fs
Sandboxed Wrapper for Node.js File System API
Stars: ✭ 41 (-48.75%)
Mutual labels:  filesystem
VBCorLib
The VBCorLib framework brings many of the powerful .NET classes to VB6.
Stars: ✭ 81 (+1.25%)
Mutual labels:  filesystem

EonilFSEvents

Eonil 2018 Maintenance. 2019 Maintenance.

Build Status

It's possible to use FSEvents directly in Swift, but it still involves many boilerplate works and subtle conversions.

This library provides mostly-faithful wrapper around FSEvents feature tailored for Swift 5.

Quickstart

Import.

import EonilFSEvents

Start.

try EonilFSEvents.startWatching( 
    paths: ["/"],
    for: ObjectIdentifier(self),
    with: { event in print(event) })

Stop.

EonilFSEvents.stopWatching(for: ObjectIdentifier(self))

Using Full Features

Make a EonilFSEventStream, schedule it to a GCD queue, and start.

let s = try EonilFSEventStream(pathsToWatch: paths,
    sinceWhen: .now,
    latency: 0,
    flags: [],
    handler: handler)
s.setDispatchQueue(DispatchQueue.main)
try s.start()

After use, deinitialize by stop, invalidate(unschedule).

s.stop()
s.invalidate()

As soon as the last strong reference gets removed, the stream will be destroyed.

Caveats

In the Xcode, AppKit apps are configured to use Sandbox by default. Sandboxed apps cannot access files out of its container. Therefore, it could look like it cannot receive file system events out of the container. To receive file system events out of container, you should turn off sandboxing.

At this point, xcodebuild fails on dependency resolution for packages. I don't know why. It seems Xcode have some issues with it. To work around, just set SYMROOT explicitly. See test.zsh how to set it.

Credits & License

Copyright(c) 2018 Hoon H., Eonil. All rights reserved. Use of this library is granted under "MIT License".

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].