(files: Array<string | { path: string }>)
| 79 | } |
| 80 | |
| 81 | export function writeClipboardFiles(files: Array<string | { path: string }>): boolean { |
| 82 | const filePaths = normalizeFilePaths(files) |
| 83 | if (filePaths.length === 0) { |
| 84 | throw new Error('files array cannot be empty') |
| 85 | } |
| 86 | |
| 87 | if (os.platform() === 'win32') { |
| 88 | return ClipboardMonitor.setClipboardFiles(filePaths) |
| 89 | } |
| 90 | |
| 91 | if (os.platform() === 'darwin') { |
| 92 | const plistData = plist.stringify(filePaths) |
| 93 | clipboard.writeBuffer(MAC_FILE_PBOARD_TYPE, Buffer.from(plistData)) |
| 94 | return true |
| 95 | } |
| 96 | |
| 97 | return false |
| 98 | } |
no test coverage detected