MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / processImage

Function processImage

src/utils/file-processing.ts:36–55  ·  view source on GitHub ↗
(image: File)

Source from the content-addressed store, hash-verified

34 * This validates the image can be read and prepares it for display
35 */
36const processImage = async (image: File): Promise<void> =>
37 new Promise((resolve, reject) => {
38 const reader = new FileReader();
39
40 reader.onload = () => {
41 // Image has been read and is ready for display
42 resolve();
43 };
44
45 reader.onerror = () => {
46 reject(new Error(`Failed to read image: ${image.name}`));
47 };
48
49 reader.onabort = () => {
50 reject(new Error(`Image reading was aborted: ${image.name}`));
51 };
52
53 // Read the image as data URL - this takes time for large images
54 reader.readAsDataURL(image);
55 });
56
57/**
58 * Process multiple files concurrently with individual error handling

Callers 1

processImagesFunction · 0.85

Calls 2

readAsDataURLMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected