MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / createTempImageFile

Function createTempImageFile

lib/image-upload.js:19–30  ·  view source on GitHub ↗
(buffer, mediaType, uploadId)

Source from the content-addressed store, hash-verified

17// Temp File Management
18// ============================================================
19function 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
32function cleanupImageUpload(uploadId) {
33 const upload = state.pendingImageUploads.get(uploadId);

Callers 3

setupWebSocketServerFunction · 0.85
handleImageUploadFunction · 0.85
test-modules.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected