Sign in
Log inSign up

Is using Chokidar for non-development automation weird?

Rup's photo
Rup
·Jun 20, 2018

I've been meaning to find ways to automate stuff on my desktop, and recently figured I could use chokidar, which is often used for file watching during web development.

I basically just leave a node file running that uses chokidar to watch my desktop and other folders. For one task, anytime I drag an image into a folder, chokidar responds by triggering an applescript (it's actually a JXA script using javascript) that sends an email with that image as an atttachment.

I've also made it watch my desktop so that if I drag an image onto the desktop, or save any other type of file, it moves it to a folder for images/audio/video/text/pdf files, while renaming the file according to a naming convention I've set.

Is this a stupid way of doing this? I know I could use bash to do much of this stuff, but there are some things I simply would never know how to accomplish in bash, whereas by leveraging javascript ttools and node packages I can manipulate the desktop using apple's accesibility features and get creative.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct