How to use the safefs.exists 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
tasks.addTask('check if the file still exists', complete => {
			// Log
			this.log(
				'debug',
				`watch evaluating on: ${this.path} [state: ${this.state}]`
			)

			// Check if this is still needed
			if (this.state !== 'active') {
				this.log('debug', `watch discarded on: ${this.path}`)
				tasks.clearRemaining()
				return complete()
			}

			// Check if the file still exists
			fsUtil.exists(this.path, exists => {
				// Apply local global property
				previousStat = this.stat

				// If the file still exists, then update the stat
				if (exists === false) {
					// Log
					this.log('debug', `watch emit delete: ${this.path}`)

					// Apply
					this.stat = null
					this.close('deleted')
					this.emit('change', 'delete', this.path, null, previousStat)

					// Clear the remaining tasks, as they are no longer needed
					tasks.clearRemaining()
					return complete()
github bevry-archive / feedr / source / index.js View on Github external
function readFile(path, readFileComplete) {
			// Log
			me.log(
				'debug',
				`Feedr === reading [${feed.url}] on [${path}], checking exists`
			)

			// Check the the file exists
			safefs.exists(path, function(exists) {
				// Check it exists
				if (!exists) {
					// Log
					me.log(
						'debug',
						`Feedr === reading [${feed.url}] on [${path}], it doesn't exist`
					)

					// Exit
					readFileComplete()
					return
				}

				// Log
				me.log(
					'debug',

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