electron/lib/renderer/api/native-image.ts
George Xu beaf60de0a
feat: add nativeImage.createThumbnailFromPath API (#24802)
* initial commit, mac implementation

* add documentation

* convert createThumbnailFromPath to async function

* windows impl protoype

* add tests

* added test

* fix

* fix test

* clean up

* update docs

* cleaning up code

* fix test

* retrigger CI

* retrigger CI

* refactor from app to native_image

* windows build

* lint

* lint

* add smart pointers, fix test

* change tests and update docs

* fix test, remove nolint

* add renderer-main process routing to fix tests

* lint

* thanks sam

* thanks sam
2020-08-24 09:36:13 -07:00

10 lines
476 B
TypeScript

import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import { deserialize } from '@electron/internal/common/type-utils';
const { nativeImage } = process._linkedBinding('electron_common_native_image');
nativeImage.createThumbnailFromPath = async (path: string, size: Electron.Size) => {
return deserialize(await ipcRendererInternal.invoke('ELECTRON_NATIVE_IMAGE_CREATE_THUMBNAIL_FROM_PATH', path, size));
};
export default nativeImage;