(buffer, mediaType, uploadId)
| 17 | // Temp File Management |
| 18 | // ============================================================ |
| 19 | function createTempImageFile(buffer, mediaType, uploadId) { |
| 20 | const isLinux = process.platform !== 'win32' && process.platform !== 'darwin'; |
| 21 | const tmpDir = isLinux |
| 22 | ? path.join(state.CWD, 'tmp') |
| 23 | : (process.env.CLAUDE_CODE_TMPDIR || os.tmpdir()); |
| 24 | const type = String(mediaType || 'image/png').toLowerCase(); |
| 25 | const ext = type.includes('jpeg') || type.includes('jpg') ? '.jpg' : '.png'; |
| 26 | fs.mkdirSync(tmpDir, { recursive: true }); |
| 27 | const tmpFile = path.join(tmpDir, `bridge_upload_${uploadId}_${Date.now()}${ext}`); |
| 28 | fs.writeFileSync(tmpFile, buffer); |
| 29 | return tmpFile; |
| 30 | } |
| 31 | |
| 32 | function cleanupImageUpload(uploadId) { |
| 33 | const upload = state.pendingImageUploads.get(uploadId); |
no outgoing calls
no test coverage detected