mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-22 18:56:31 +00:00
test: Remove unnecessary file-exists
dependency
Change-Type: patch
This commit is contained in:
parent
c3600ee8fc
commit
04352494a0
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
@ -2512,11 +2512,6 @@
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"file-exists": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-exists/-/file-exists-1.0.0.tgz",
|
||||
"dev": true
|
||||
},
|
||||
"file-name": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/file-name/-/file-name-0.1.0.tgz",
|
||||
|
@ -106,7 +106,6 @@
|
||||
"eslint-plugin-node": "6.0.0",
|
||||
"eslint-plugin-promise": "3.6.0",
|
||||
"eslint-plugin-standard": "3.0.1",
|
||||
"file-exists": "1.0.0",
|
||||
"html-angular-validate": "0.1.9",
|
||||
"mocha": "3.2.0",
|
||||
"mochainon": "1.0.0",
|
||||
|
@ -19,8 +19,7 @@
|
||||
const m = require('mochainon')
|
||||
const _ = require('lodash')
|
||||
const Bluebird = require('bluebird')
|
||||
const fileExists = require('file-exists')
|
||||
const fs = Bluebird.promisifyAll(require('fs'))
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const imageStream = require('../../lib/image-stream/index')
|
||||
@ -35,9 +34,14 @@ const doFilesContainTheSameData = (file1, file2) => {
|
||||
}
|
||||
|
||||
const deleteIfExists = (file) => {
|
||||
return Bluebird.try(function () {
|
||||
if (fileExists(file)) {
|
||||
return fs.unlinkAsync(file)
|
||||
return Bluebird.try(() => {
|
||||
try {
|
||||
fs.accessSync(file)
|
||||
fs.unlinkSync(file)
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') {
|
||||
return Bluebird.reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
return Bluebird.resolve()
|
||||
|
Loading…
x
Reference in New Issue
Block a user