mirror of
https://github.com/zyphlar/doorlock.git
synced 2024-04-03 21:36:03 +00:00
readfile async is causing lots of problems
This commit is contained in:
parent
ad1d060cdc
commit
5d263d070d
|
@ -6,10 +6,9 @@ const CARDS_PATH = path.join(process.cwd(), 'cards.json')
|
|||
module.exports = class Cards {
|
||||
static all() {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.readFile(CARDS_PATH, (err, data) => {
|
||||
if (err) return reject(err)
|
||||
resolve(JSON.parse(data))
|
||||
})
|
||||
var cards = fs.readFileSync(CARDS_PATH, "utf8")
|
||||
var out = JSON.parse(cards)
|
||||
resolve(out)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user