diff --git a/apps/1test/src/electron/fsPlugin.ts b/apps/1test/src/electron/fsPlugin.ts index 1ee2a43d7d..7b3cc133ea 100644 --- a/apps/1test/src/electron/fsPlugin.ts +++ b/apps/1test/src/electron/fsPlugin.ts @@ -1,8 +1,9 @@ import { PluginClient } from "@remixproject/plugin"; import { createClient } from "./electronPluginClient" import { Engine, PluginManager, Plugin } from '@remixproject/engine'; -import fs from 'fs' -import { existsSync } from "fs-extra"; +import fs from 'fs/promises' +import { Stats } from "fs"; + const profile = { displayName: 'fs', @@ -34,39 +35,36 @@ class FSPluginClient extends PluginClient { async readdir(path: string): Promise { // call node fs.readdir - return fs.readdirSync(path) + return fs.readdir(path) } async readFile(path: string): Promise { - return fs.readFileSync(path, 'utf8') + return fs.readFile(path, 'utf8') } async writeFile(path: string, content: string): Promise { - return fs.writeFileSync(path, content, 'utf8') + return fs.writeFile(path, content, 'utf8') } async mkdir(path: string): Promise { - return fs.mkdirSync(path) + return fs.mkdir(path) } async rmdir(path: string): Promise { - return fs.rmdirSync(path) + return fs.rmdir(path) } async unlink(path: string): Promise { - return fs.unlinkSync(path) + return fs.unlink(path) } async rename(oldPath: string, newPath: string): Promise { - return fs.renameSync(oldPath, newPath) + return fs.rename(oldPath, newPath) } - async stat(path: string): Promise { - return fs.statSync(path) + async stat(path: string): Promise { + return fs.stat(path) } - async exists(path: string): Promise { - return existsSync(path) - } } \ No newline at end of file diff --git a/apps/1test/src/renderer.ts b/apps/1test/src/renderer.ts index 020d3dba0b..015e0ffea2 100644 --- a/apps/1test/src/renderer.ts +++ b/apps/1test/src/renderer.ts @@ -13,12 +13,12 @@ const git = new gitPlugin() engine.register(appManager) engine.register(fs) engine.register(git) -//appManager.activatePlugin('fs') +appManager.activatePlugin('fs') appManager.activatePlugin('git') setTimeout(async () => { - //const files = await appManager.call('fs', 'readdir', './') - //console.log('files', files) + const files = await appManager.call('fs', 'readdir', './') + console.log('files', files) const log = await appManager.call('git', 'log', './') console.log('log', log) }, 5000)