How to use the safefs.watch function in safefs

To help you get started, we’ve selected a few safefs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bevry / watchr / source / index.js View on Github external
watchMethod(method /* :MethodEnum */, next /* :ErrorCallback */) /* :void */ {
		if (method === 'watch') {
			// Check
			if (fsUtil.watch == null) {
				const err = new Error(
					'watch method is not supported on this environment, fs.watch does not exist'
				)
				next(err)
				return
			}

			// Watch
			try {
				this.fswatcher = fsUtil.watch(this.path, (...args) =>
					this.listener({ method, args })
				)
				// must pass the listener here instead of doing fswatcher.on('change', opts.listener)
				// as the latter is not supported on node 0.6 (only 0.8+)
			} catch (err) {
				next(err)
				return
			}

			// Success
			next()
			return
		} else if (method === 'watchFile') {
			// Check
			if (fsUtil.watchFile == null) {
				const err = new Error(

safefs

Stop getting EMFILE errors! Open only as many files as the operating system supports.

Artistic-2.0
Latest version published 10 months ago

Package Health Score

63 / 100
Full package analysis