-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixbug no file exist check #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,13 @@ exports.inputExistCheck = (input) => | |
input.newsLink ? resolve(input.newsLink) : reject(Err_DontGetNewsLink); | ||
}); | ||
|
||
|
||
//fileExitCheck in the path. | ||
exports.fileExistCheck = (path) => | ||
new Promise((resolve, reject) => { | ||
fs.existsSync(path)? resolve(true) : reject(false); | ||
}); | ||
Comment on lines
+49
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要什么东西都封装成 Promise 异步的…… There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我只是看到里面代码大部分是这样的, 就想保持语法风格的统一。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
不能形式大于内容,过多异步也拖性能。 |
||
|
||
// Check the input parameters, and get the routing address of the article. | ||
// - 原文网址:[原文标题](https://www.freecodecamp.org/news/xxxxxxx/ | ||
exports.getRouteAddr = (URL) => | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async 函数里可以用同步的思维写