refactor: use plugin call for read and write file

pull/5238/head
Amirhossein Azarpour 2 months ago
parent 62f1312218
commit b4f3bcd9d3
  1. 4
      apps/circuit-compiler/src/app/actions/index.ts

@ -169,12 +169,12 @@ function trackEvent(plugin, eventCategory, action, label) {
}
async function readFileAsUint8Array(plugin: CircomPluginClient, path: string): Promise<Uint8Array> {
const data = await plugin.readFile(path)
const data = await plugin.call('fileManager', 'readFile', path, { encoding: null })
return new Uint8Array(data.split(',').map(byte => parseInt(byte, 10)))
}
async function writeFile(plugin: CircomPluginClient, path: string, content: string) {
await plugin.writeFile(path, content)
await plugin.call('fileManager', 'writeFile', path, content)
}
function handleError(plugin: CircomPluginClient, event: string, error: Error) {

Loading…
Cancel
Save