How to use the removeAsync function from fs-extra

Find comprehensive JavaScript fs-extra.removeAsync code examples handpicked from public code repositorys.

38
39
40
41
42
43
44
45
46
47
onStdout('Made staging dir');

stagedSketchDir = path.join('/opt/openrov/firmware/staged/', sketchName);

// Remove existing sketch folder if it exists
return fs.removeAsync(stagedSketchDir)
    .then(function()
    {
        // Copy the sketch folder to the staging sketch dir
        return fs.copyAsync(options.sketchDir, stagedSketchDir);
fork icon94
star icon63
watch icon33

+ 3 other calls in file

103
104
105
106
107
108
109
110
111
112
      .then(() => {
        evt.options.pathDist = optimizedPath; // eslint-disable-line
        return evt;
      })
      // delete generated handler we copied above
      .finally(() => fs.removeAsync(generatedHandler));
  }
}

return Promise.resolve(evt);
fork icon28
star icon68
watch icon12

+ 3 other calls in file

173
174
175
176
177
178
179
180
181
182
  zipPath = await downloadAsync(url, downloadDir, filename, description)
  await extractZipAsync(zipPath, destPath, description)
} catch (e) {
  log(`Downloading failed, retrying ${url}, reason: ${e}`)
  try {
    await fs.removeAsync(zipPath)
  } catch (e) {
    console.error(e.stack)
  }
  if (retryCount === MAX_RETRY) {
fork icon356
star icon0
watch icon2

+ 3 other calls in file

178
179
180
181
182
183
184
185
186
187
  await downloadExtractZipAsync(flash_url, downloadDir, `flash-${platform}.zip`, flashDir, 'flash plugin')
}

const compress7zAsync = async (files, archive, options) => {
  try {
    await fs.removeAsync(archive)
  } catch (e) {
    console.error(e.stack)
  }
  await (new n7z()).add(archive, files, options)
fork icon356
star icon0
watch icon1

+ 5 other calls in file

56
57
58
59
60
61
62
63
64
65
function InstallFile(baseDir, file) {
  var src = path.resolve(path.join(baseDir, 'files', file.src));
  return fs.copyAsync(src, path.join(file.dest, path.basename(file.src)));
}
function UninstallFile(file) {
  return fs.removeAsync(path.join(file.dest, path.basename(file.src)));
}
function ExecuteScript(baseDir, script) {
  return Promise.try(function () {
    var src = path.resolve(path.join(baseDir, 'scripts', script.name));
fork icon94
star icon63
watch icon33

173
174
175
176
177
178
179
180
181
        Path.join(__dirname, 'requirements.py'), requirementsPy);
    }).bind(this)
    .then(_.partial(this.preinstall, wrapperDir, this.libSubDir, runtime)).bind(this)
    .then(_.partial(this.install, wrapperDir, this.libSubDir, runtime)).bind(this)
    .then(_.partial(this.postinstall, wrapperDir, this.libSubDir, runtime)).bind(this)
    //.then(() => { return Fse.removeAsync(requirementsPy); }).bind(this)
    //.then(_.partial(this.hard_remove, [requirementsPy])).bind(this)
    .then(BbPromise.resolve, _.partial(this.catchIgnorableError, undefined));
};
fork icon16
star icon25
watch icon3

+ 5 other calls in file

72
73
74
75
76
77
78
79
80
81
    .then(funcs => uniqBy(funcs, f => f.module))
    .map(f => {
      this.serverless.cli.log(
        `Removing Python requirements helper from ${f.module}...`
      );
      return fse.removeAsync(
        path.join(this.servicePath, f.module, 'unzip_requirements.py')
      );
    });
} else {
fork icon274
star icon0
watch icon14

+ 3 other calls in file

19
20
21
22
23
24
25
26
27
28
}

function deleteChapter (basePath, args) {
  const path = loc.chapterPath(basePath, args.mangaName, args.chapterNum)

  return fse.removeAsync(path)
}

function deleteManga (basePath, args) {
  const path = loc.mangaPath(basePath, args.mangaName)
fork icon2
star icon12
watch icon5

+ 3 other calls in file

10
11
12
13
14
15
16
17
18
19
module.exports = function (conf) {
    // clean 不能保证传入的 conf 一定正确,所以需要无依赖的获取一遍 ~/.adam 的路径
    var HOME = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
    var ADAM_HOME = path.join(HOME, '.adam');

    fse.removeAsync(ADAM_HOME)
        .then(function () {
            helper.print('Success', 'Adam\'s directory is removed now.');
        })
        .catch(function (ret) {
fork icon2
star icon9
watch icon9

78
79
80
81
82
83
84
85
86
87
88
89
}


function destroyLoopMount(dir) {
  return sbutil.execFilePromise('umount', [dir])
    .then(function () {
      return fs.removeAsync(dir);
    });
}


exports.mountLoopFile = mountLoopFile;
fork icon2
star icon1
watch icon0

110
111
112
113
114
115
116
117
118
119
  try {
    zipPath = await downloadAsync(url, downloadDir, filename, description);
    await extractZipAsync(zipPath, destPath, description);
  } catch (e) {
    log(`Downloading failed, retrying ${url}, reason: ${e}`);
    await fs.removeAsync(zipPath);
  }
};

const installFlashAsync = async (platform, downloadDir, flashDir) => {
fork icon0
star icon0
watch icon2

+ 7 other calls in file

99
100
101
102
103
104
105
106
107
108
return fs.accessAsync(appPath)
.then(() => {
  debug('appPath exists %s', appPath)

  // clear out the existing symlink
  return fs.removeAsync(dest)
}).then(() => {
  const symlinkType = paths.getSymlinkType()

  debug('making symlink from %s to %s of type %s', appPath, dest, symlinkType)
fork icon0
star icon0
watch icon0

function icon

fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)