Add exportFileBinary to FlipperLib

Reviewed By: antonk52

Differential Revision: D39692937

fbshipit-source-id: 7b3c78d004a9734cd8ae660d5782be1f02c00009
This commit is contained in:
Andrey Goncharov
2022-09-21 09:26:19 -07:00
committed by Facebook GitHub Bot
parent f3b7552338
commit 3314c77ce9
8 changed files with 43 additions and 0 deletions

View File

@@ -151,6 +151,18 @@ export async function initializeElectron(
await fs.promises.writeFile(filePath, data, {encoding});
return filePath;
},
async exportFileBinary(data, {defaultPath} = {}) {
const {filePath} = await electronIpcClient.send('showSaveDialog', {
defaultPath,
});
if (!filePath) {
return;
}
await fs.promises.writeFile(filePath, data, {encoding: 'binary'});
return filePath;
},
openLink(url: string) {
shell.openExternal(url);
},