How to use the unlink function from fs-promise

Find comprehensive JavaScript fs-promise.unlink code examples handpicked from public code repositorys.

239
240
241
242
243
244
245
246
247
248
249
        }
    } finally {
        if (release !== null) {
            release();
        }
        yield fs.unlink(tempIndexPath);
    }
});



fork icon51
star icon205
watch icon22

215
216
217
218
219
220
221
222
223
224
async deleteFile(fileUuid) {
  const file = this.fileList[fileUuid];
  const fileExists = await fs.exists(file.filePath);
  if (fileExists) {
    // Delete the file
    await fs.unlink(file.filePath);
    logger.info('Just deleted file', file.filePath);
    // Remove the file object from the 'files' array
    delete this.fileList[fileUuid];
    this.app.io.broadcast('fileEvent', {
fork icon20
star icon26
watch icon0

177
178
179
180
181
182
183
184
185
186
}).then(function () {
  return search(new RegExp(fileName + "$"))(archiveDir);
}).then(function (fp) {
  return fsp.rename(fp[0], filePath);
}).then(function () {
  return fsp.unlink(archivePath);
}).then(function () {
  return fileHash ? checksum(fileHash)(filePath) : null;
}).then(function () {
  return filePath;
fork icon7
star icon12
watch icon0

118
119
120
121
122
123
124
125
126
127
        "Stopped backend (host=" + server.host + " dbKey=" + server.dbKey + ")",
      );
    }
    try {
      if (server.dbFile) {
        await fs.unlink(`${server.dbFile}.mv.db`);
      }
    } catch (e) {}
  },
});
fork icon0
star icon0
watch icon1