How to use the fs.unlink function in fs

To help you get started, we’ve selected a few fs 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 thkl / homebridge-homematic / util / fetchdevice.js View on Github external
// parse This
  console.info("Resonse from ccu is %s bytes",data.length);
  console.info("Rebuilding JSON");
  let jData = JSON.parse(data);
  let device = jData.devices[0];
  if (device!=undefined) {
  let adr = device.address;
  let dtype = device.type;
  device.address = "ADR1234567890";
  device.channels.map(function (channel){
    channel.address = channel.address.replace(adr,"ADR1234567890");
  })
  let fileName = path.join(__dirname,'..','test','lib','data','data_test_') + dtype + ".json";
  if (fs.existsSync(fileName)) {
      console.info("moving old file into trash");
      fs.unlink(fileName);
	}
  var buffer = JSON.stringify(jData,null, 2);
	fs.writeFileSync(fileName, buffer);
  console.info("written to %s",fileName);
} else {
  console.info("No data for %s",program.address)
}
})
github GlowingSoftware / Glowy / src / serverControllers / plugins.js View on Github external
}).on('error', function(err) { // Handle errors
    fs.unlink(dest); // Delete the file async. (But we don't check the result)
    if (cb) cb(err.message);
  });
}
github paixaop / node-sodium / install.js View on Github external
}).on('error', function(err) { // Handle errors
        fs.unlink(dest); // Delete the file async. (But we don't check the result)
        if (cb) cb(err);
    });
}
github CityWebConsultants / Iris / config.js View on Github external
delete iris.configStore[configStoreCategory][configStoreInstance][filename];

  } else {

    if (iris.configStore[directory]) {
      delete iris.configStore[directory][filename];
    }

  }

  var filePath = path.join(iris.sitePath, "/configurations", directory);

  filePath = filePath + '/' + filename + '.json';

  fs.unlink(filePath, function (err) {

    if (err) {

      // Return err = true
      callback(true);

    } else {

      callback(false);

    }

  });

};
github timoxley / linklocal / test / index.js View on Github external
linklocal(PKG_DIR, function (err, linked) {
    t.ifError(err)
    var links = linked.map(getLink).sort()
    t.deepEqual(links, LINKS)
    fs.unlink(links[0], function (err) {
      t.ifError(err)
      linklocal.unlink(PKG_DIR, function (err, linked) {
        t.ifError(err)
        var expected = LINKS.slice(1)
        t.deepEqual(linked.map(getLink).sort(), expected)
        expected.forEach(function (link) {
          t.notOk(fs.existsSync(link))
        })
        t.end()
      })
    })
  })
})
github ivere27 / secc / lib / compile.js View on Github external
          self.outputFiles.forEach(function(outfile){fs.unlink(outfile.path);});
          return self.emit('finish', new Error('CompileStream error. file stream error.'), self._stdout, self._stderr, code);
github shimondoodkin / node_spreadsheet / index.js View on Github external
fs.readFile(file, 'utf-8', function (err, data) 
    {
     fs.unlink(file, function(err2)
     {
      if (err) throw err;
      //if (err2) throw err;
      console.log(data.toString());
      callback(JSON.parse(data,isoDateReviver));
      //callback(eval(data));
     });
    });
   }
github corymickelson / CommonPdf / src / digital-signature.spec.ts View on Github external
.then( () => {
			unlink( outfile, ( err: Error ) => {
				if(err) console.log( 'failed to clean up test file' )
			} )
		} )
} )
github verdaccio / local-storage / src / local-fs.ts View on Github external
const cb = err => {
    if (err) {
      fs.unlink(src, function() {});
    }
    _cb(err);
  };
github log4js-node / log4js-node / lib / streams / DateRollingFileStream.js View on Github external
function deleteAnyExistingFile(cb) {
    //on windows, you can get a EEXIST error if you rename a file to an existing file
    //so, we'll try to delete the file we're renaming to first
    fs.unlink(newFilename, function (err) {
      //ignore err: if we could not delete, it's most likely that it doesn't exist
      cb();
    });
  }

fs

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

70 / 100
Full package analysis