feat: use fs/promise instead fs

promise instead fs
This commit is contained in:
NEMO 2022-04-06 14:38:36 +08:00 committed by GitHub
parent 302bea9718
commit 1a18501a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { lstat } from 'fs'
import { lstat } from 'fs/promises'
import { cwd } from 'process'
import { ipcRenderer } from 'electron'
@ -7,10 +7,8 @@ ipcRenderer.on('main-process-message', (_event, ...args) => {
console.log('[Receive Main-process message]:', ...args)
})
lstat(cwd(), (err, stats) => {
if (err) {
console.log(err)
} else {
lstat(cwd()).then(stats => {
console.log('[fs.lstat]', stats)
}
}).catch(err => {
console.error(err)
})