MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / getImagePathFromClipboard

Function getImagePathFromClipboard

src/utils/imagePaste.ts:253–270  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251}
252
253export async function getImagePathFromClipboard(): Promise<string | null> {
254 const { commands } = getClipboardCommands()
255
256 try {
257 // Try to get text from clipboard
258 const result = await execa(commands.getPath, {
259 shell: true,
260 reject: false,
261 })
262 if (result.exitCode !== 0 || !result.stdout) {
263 return null
264 }
265 return result.stdout.trim()
266 } catch (e) {
267 logError(e as Error)
268 return null
269 }
270}
271
272/**
273 * Regex pattern to match supported image file extensions. Kept in sync with

Callers 1

tryReadImageFromPathFunction · 0.85

Calls 2

getClipboardCommandsFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected