Skip to content

Commit

Permalink
fix: rimrif
Browse files Browse the repository at this point in the history
  • Loading branch information
JunyWuuuu91 committed Jun 28, 2022
1 parent 05b0e99 commit fc7aa49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ const { resolve } = require("path");

function createDir(dirname) {
const dir = resolve(__dirname, "..", dirname);
fs.existsSync(dir) ? rimraf(dir) : fs.mkdirSync(dir);
fs.existsSync(dir)
? rimraf(dir, (e) => {
console.log("删除", e);
})
: fs.mkdirSync(dir);
}
createDir("shots");
createDir("pdf");
Expand Down
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Koa = require("koa");
const app = new Koa();
const { run } = require("./lib");
const { run } = require("./screenshot");

app.use(async (ctx) => {
const { request } = ctx;
Expand Down

0 comments on commit fc7aa49

Please sign in to comment.