MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / getFileIcon

Method getFileIcon

src/main/core/native/index.ts:757–765  ·  view source on GitHub ↗

* 异步获取文件/应用的图标(PNG 格式 Buffer) * @param {string} filePath - 文件路径(可以是 .exe、.lnk、.dll 或任何文件类型) * @returns {Promise } Promise,resolve 为 PNG 格式的图标数据 * @example * // 获取 exe 的图标 * const icon = await IconExtractor.getFileIcon('C:\\Windows\\notepad.exe'); * * // 保存为文件 * const f

(filePath: string)

Source from the content-addressed store, hash-verified

755 * if (icon) fs.writeFileSync('icon.png', icon);
756 */
757 static getFileIcon(filePath: string): Promise<Buffer> {
758 if (platform !== 'win32' && platform !== 'darwin') {
759 throw new Error('getFileIcon is only supported on Windows and macOS')
760 }
761 if (typeof filePath !== 'string' || !filePath) {
762 throw new TypeError('filePath must be a non-empty string')
763 }
764 return (addon as NativeAddon).getFileIcon(filePath)
765 }
766}
767
768/**

Callers 3

extractIconFunction · 0.80
addShortcutMethod · 0.80
addShortcutByPathMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected