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 {
|
module.exports = class Cards {
|
||||||
static all() {
|
static all() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.readFile(CARDS_PATH, (err, data) => {
|
var cards = fs.readFileSync(CARDS_PATH, "utf8")
|
||||||
if (err) return reject(err)
|
var out = JSON.parse(cards)
|
||||||
resolve(JSON.parse(data))
|
resolve(out)
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user