()
| 19 | function createDarwinNativeModule(): NativeModule { |
| 20 | return { |
| 21 | hasClipboardImage(): boolean { |
| 22 | try { |
| 23 | const result = Bun.spawnSync({ |
| 24 | cmd: [ |
| 25 | 'osascript', |
| 26 | '-e', |
| 27 | 'try\nthe clipboard as «class PNGf»\nreturn "yes"\non error\nreturn "no"\nend try', |
| 28 | ], |
| 29 | stdout: 'pipe', |
| 30 | stderr: 'pipe', |
| 31 | }) |
| 32 | const output = result.stdout.toString().trim() |
| 33 | return output === 'yes' |
| 34 | } catch { |
| 35 | return false |
| 36 | } |
| 37 | }, |
| 38 | |
| 39 | readClipboardImage( |
| 40 | maxWidth?: number, |