How to use the safefs.unwatchFile 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
if (this.state !== 'active') return this

		// Close
		this.log('debug', `close: ${this.path}`)

		// Close our children
		eachr(this.children, child => {
			child.close(reason)
		})

		// Close watch listener
		if (this.fswatcher != null) {
			this.fswatcher.close()
			this.fswatcher = null
		} else {
			fsUtil.unwatchFile(this.path)
		}

		// Updated state
		if (reason === 'deleted') {
			this.state = 'deleted'
		} else {
			this.state = 'closed'
		}

		// Emit our close event
		this.log('debug', `watch closed because ${reason} on ${this.path}`)
		this.emit('close', reason)

		// Chain
		return this
	}

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