setup data pipeline to convert heic natively
This commit is contained in:
parent
c5c20ae0c0
commit
c63060780c
14
src/api/heicConvert.ts
Normal file
14
src/api/heicConvert.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { ipcRenderer } from 'electron/renderer';
|
||||
import { isPlatformMac } from '../utils/main';
|
||||
|
||||
export async function convertHEIC(fileData: Uint8Array, outputType: string) {
|
||||
if (!isPlatformMac()) {
|
||||
throw Error('native heic conversion only supported on mac');
|
||||
}
|
||||
const convertedFileData = await ipcRenderer.invoke(
|
||||
'convert-heic',
|
||||
fileData,
|
||||
outputType
|
||||
);
|
||||
return convertedFileData;
|
||||
}
|
|
@ -13,6 +13,7 @@ import { logErrorSentry } from '../services/sentry';
|
|||
import chokidar from 'chokidar';
|
||||
import path from 'path';
|
||||
import { getDirFilePaths } from '../services/fs';
|
||||
import { convertHEIC } from '../services/heicConversion';
|
||||
|
||||
export default function setupIpcComs(
|
||||
tray: Tray,
|
||||
|
@ -96,4 +97,8 @@ export default function setupIpcComs(
|
|||
ipcMain.handle('get-path', (_, message) => {
|
||||
return app.getPath(message);
|
||||
});
|
||||
|
||||
ipcMain.handle('convert-heic', (_, fileData, outputType) => {
|
||||
return convertHEIC(fileData, outputType);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue