diff --git a/packages/renderer/src/samples/node-api.ts b/packages/renderer/src/samples/node-api.ts index 0a1d7ce..8668059 100644 --- a/packages/renderer/src/samples/node-api.ts +++ b/packages/renderer/src/samples/node-api.ts @@ -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 { - console.log('[fs.lstat]', stats) - } +lstat(cwd()).then(stats => { + console.log('[fs.lstat]', stats) +}).catch(err => { + console.error(err) })