Skip to content

Commit

Permalink
fix: delete file
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed May 4, 2021
1 parent 7ef844b commit dca4152
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/api/helpers/delete-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMMNNNMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
*/
import path = require('path');
import { unlinkSync, existsSync } from 'fs';
import { existsSync, unlink } from 'fs';
import * as Spinnies from 'spinnies';
export function deleteFiles(
export async function deleteFiles(
mergedOptions: any,
Session: String,
spinnies: Spinnies
Expand All @@ -69,16 +69,16 @@ export function deleteFiles(
`${Session}.data.json`
);
if (existsSync(pathTokens)) {
try {
unlinkSync(pathTokens);
unlink(pathTokens, (err) => {
if (err) {
spinnies.fail(`removeFile`, {
text: `Not removed file: ${pathTokens}`,
});
}
spinnies.succeed(`removeFile`, {
text: `Removed file: ${pathTokens}`,
});
} catch (err) {
spinnies.fail(`removeFile`, {
text: `Not removed file: ${pathTokens}`,
});
}
});
} else {
spinnies.fail(`removeFile`, { text: `Not Files: ${pathTokens}` });
}
Expand Down

0 comments on commit dca4152

Please sign in to comment.