Using Sync Gateway to sync document deletion with files on local filesystem

I’m working with a local couchbase server containing documents with paths to files on local filesystem ( files being large images) .I have an application that manage inserts, updates, etc. I would like to know if there is a way to sync, for example, the deletion of the file when the document is deleted from couchbase server. I read about Sync Gateway and Webhooks, so maybe i could use this to send ID’s of deleted documents to a local http server and then have a script that deletes the file locally? This is completely theoretical as I have never done something like that. If someone have an idea or a suggestion, I’m all ears!
Thank you.

There’s a lot of ways to accomplish this.

You can use WebHooks to a webserver. (Server Integration)
You can build an app using Couchbase Lite and connecting to Sync Gateway could monitor documents for changes/deletions. (Couchbase Lite)
You could build an app to listen to the server’s DCP feed and react (See Everything DCP).

Or something else. Lots of versatility and options.

Thank you for the options !