(data: PastedImageInput['data'])
| 2972 | } |
| 2973 | |
| 2974 | function pastedImageBuffer(data: PastedImageInput['data']): Buffer { |
| 2975 | if (data instanceof ArrayBuffer) return Buffer.from(data) |
| 2976 | if (ArrayBuffer.isView(data)) { |
| 2977 | return Buffer.from(data.buffer, data.byteOffset, data.byteLength) |
| 2978 | } |
| 2979 | throw new Error('Clipboard image data is invalid.') |
| 2980 | } |
| 2981 | |
| 2982 | /** |
| 2983 | * Make a title safe to use as a filename on macOS, Windows, and Linux: |