Tabnine Logo For Javascript
unlink
Code IndexAdd Tabnine to your IDE (free)

How to use
unlink
function
in
fs

Best JavaScript code snippets using fs.unlink(Showing top 15 results out of 1,836)

origin: sx1989827/DOClever

function  delImg(filePath) {
  if(filePath)
  {
    fs.access(con.filePath+filePath.replace(/\//g,path.sep),fs.constants.F_OK,function (err) {
      if(!err)
      {
        fs.unlink(con.filePath+filePath);
      }
    })
  }
}
origin: Sly777/ran

/**
 * Deletes a file in the current directory
 */
function deleteFileInCurrentDir(file, callback) {
 fs.unlink(path.join(__dirname, file), callback);
}
origin: sx1989827/DOClever

output.on('close', function() {
        rm(path.join(con.filePath,"temp",name),{},function (err) {

        });
        res.download(pathName,req.obj.name+".zip",function (err) {
          if(!err)
          {
            obj.removeAsync();
            fs.access(pathName,fs.constants.F_OK,function (err) {
              if(!err)
              {
                fs.unlink(pathName);
              }
            })
          }
        });
      });
origin: remoteinterview/zero

function getPipInstaller() {
 // install pip
 return new Promise((resolve, reject) => {
  const pipFilePath = path.join(__dirname, "get-pip.py");
  if (fs.existsSync(pipFilePath)) return resolve(pipFilePath);

  const file = fs.createWriteStream(pipFilePath);
  const request = https.get(pipUrl, function(response) {
   response.pipe(file);
   file.on("finish", function() {
    file.close(() => {
     resolve(pipFilePath);
    });
   });
   file.on("error", function(err) {
    fs.unlink(pipFilePath);
    reject(err);
   });
  });
 });
}
origin: Flood-UI/flood

deleteFile(filename) {
  fs.unlink(this.getTempPath(filename));
 }
origin: ivanseidel/Is-Now-Illegal

fs.unlink(filePath, () => {})
origin: pubkey/broadcast-channel

async function cleanOldMessages(messageObjects, ttl) {
  const olderThen = Date.now() - ttl;
  await Promise.all(
    messageObjects
      .filter(obj => (obj.time / 1000) < olderThen)
      .map(obj => unlink(obj.path).catch(() => null))
  );
}
origin: o2team/athena

fs.readdir(dir, function(err, files) {
    if(err && typeof failSilent === 'boolean' && !failSilent)
    return clbk(err);

    if(typeof failSilent === 'function')
      clbk = failSilent;

    (function rmFile(err){
      if (err) return clbk(err);

      var filename = files.shift();
      if (filename === null || typeof filename == 'undefined')
        return fs.rmdir(dir, clbk);

      var file = dir+'/'+filename;
      fs.lstat(file, function(err, stat){
        if (err) return clbk(err);
        if (stat.isDirectory())
          rmdirRecursive(file, rmFile);
        else
          fs.unlink(file, rmFile);
      });
    })();
  });
origin: paschmann/rasa-ui

function removeModel(req, res, next) {
 logger.winston.info('Model.removeModel');
 db.run('delete from models where model_id = ?', req.query.model_id, function(err) {
  if (err) {
   logger.winston.error("Error removing the record");
  } else {
   if (req.query.local_path && req.query.local_path != "Manually Added") {
    fs.unlink(req.query.local_path, (err) => {
     if (err) {
      logger.winston.info(err)
      return
     }
    })
   }
   res.status(200).json({ status: 'success', message: 'Removed' });
  }
 });
}
origin: service-bot/servicebot

  callback(env);
}).catch(function(err){
  fs.unlink(envPath);
origin: service-bot/servicebot

fs.unlink(filePath, err => {
  if (err) {
    console.log("error deleting file " + err);
origin: richardgirges/express-fileupload

/**
 * Deletes a file.
 * @param {string} file - Path to the file to delete.
 * @param {Function} callback
 */
const deleteFile = (file, callback) => fs.unlink(file, callback)
origin: yodaos-project/yoda.js

function cleanup (callback) {
 fs.unlink(constants.infoFile, function onUnlink () {
  /** ignore any error */
  cleanImages(callback)
 })
}
origin: remoteinterview/zero

function getPipInstaller() {
 // install pip
 return new Promise((resolve, reject) => {
  const pipFilePath = path.join(__dirname, "get-pip.py");
  if (fs.existsSync(pipFilePath)) return resolve(pipFilePath);

  const file = fs.createWriteStream(pipFilePath);
  const request = https.get(pipUrl, function(response) {
   response.pipe(file);
   file.on("finish", function() {
    file.close(() => {
     resolve(pipFilePath);
    });
   });
   file.on("error", function(err) {
    fs.unlink(pipFilePath);
    reject(err);
   });
  });
 });
}
origin: RuntimeTools/appmetrics

function deleteFile(filename) {
 fs.unlink(filename);
}
fsunlink

JSDoc

Asynchronous unlink(2) - delete a name and possibly the file it refers to.

Most used fs functions

  • readFileSync
    Synchronously reads the entire contents of a file.
  • existsSync
    Synchronously tests whether or not the given path exists by checking with the file system.
  • readFile
    Asynchronously reads the entire contents of a file.
  • readdirSync
    Synchronous readdir(3) - read a directory.
  • writeFile
    Asynchronously writes data to a file, replacing the file if it already exists.
  • createReadStream,
  • createWriteStream,
  • Stats.isDirectory,
  • statSync,
  • mkdirSync,
  • unlinkSync,
  • ReadStream.pipe,
  • readdir,
  • Stats.isFile,
  • WriteStream.on,
  • stat,
  • ReadStream.on,
  • Stats.size

Popular in JavaScript

  • js-yaml
    YAML 1.2 parser and serializer
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • crypto
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • minimist
    parse argument options
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • minimatch
    a glob matcher in javascript
  • moment
    Parse, validate, manipulate, and display dates
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now