Images

#Overview

List all images in the unzipped IPA directory.

#How It Works

The compute function first creates an images subdirectory within the scanPath to store the processed images. It then uses thefind command to locate all files with common image extensions (.png, .jpg, .jpeg, .gif, .webp) within the unzipped IPA directory. For each found image, it uses the defryPng utility to convert and optimize the image, saving it as a new PNG file in theimages subdirectory. The converted filename will have a.converted.png suffix (e.g., original-image.png.converted.png).

The get function is responsible for retrieving the data. It reads the files from the images subdirectory, filters for files ending with .converted.png, which are the images processed by thecompute function. For each converted image, it reads the file, obtains its size, extracts the original filename (by removing the.converted.png suffix), and converts the image content to abase64-encoded string. Finally, it returns an array of objects, where each object represents an image with its original name, size, and base64-encoded content.

#Example Output

[
  {
    "name": "example_image.png",
    "size": 12345,
    "base64": "iVBORw0KGgoAAAANSUhEUgAA..."
  },
  {
    "name": "another_image.jpg",
    "size": 67890,
    "base64": "iVBORw0KGgoAAAANSUhEUgAA..."
  }
]