diff --git a/electron/src/electron/filesystem.ts b/electron/src/electron/filesystem.ts index a51f93ee3..66ec7e42e 100644 --- a/electron/src/electron/filesystem.ts +++ b/electron/src/electron/filesystem.ts @@ -89,7 +89,12 @@ export class FilesystemPluginElectron extends WebPlugin implements FilesystemPlu if(Object.keys(this.fileLocations).indexOf(options.directory) === -1) reject(`${options.directory} is currently not supported in the Electron implementation.`); let lookupPath = this.fileLocations[options.directory] + options.path; - this.NodeFS.appendFile(lookupPath, options.encoding, options.data, (err:any) => { + let data: (Buffer | string) = options.data; + if (!options.encoding) { + const base64Data = options.data.indexOf(',') >= 0 ? options.data.split(',')[1] : options.data; + data = Buffer.from(base64Data, 'base64'); + } + this.NodeFS.appendFile(lookupPath, data, options.encoding || 'binary', (err:any) => { if(err) { reject(err); return;