const fs = require('fs').promises; const ms = require('ms'); const os = require('os'); const path = require('path'); const { spawn } = require('child_process'); const getHooksRoot = () => path.join(os.homedir(), '/.syncthing-hooks'); const readHooksRoot = async root => { try { const files = await fs.readdir(root); return files; } catch (error) { console.error(error); return []; } }; const parseHooks = (root, hooks) => hooks .map(x => ({ path: path.join(root, x), match: x.match(/(?.{11})-(?