Function SelectImageFilesPrompt

  • Prompts the user to select image files from a given folder.

    Parameters

    • folder: Dirent[]

      Array of Dirent objects representing the files in the folder.

    Returns Promise<string[] | undefined>

    • A promise that resolves to an array of selected file paths or undefined if an error occurs. The prompt allows the user to choose from a list of available image files. If the folder is empty, logs a message and returns an empty array. Uses a checkbox prompt to display file choices and validates them using imageFilesValidation. Handles any errors by invoking handlePromptError.
    await SelectImageFilesPrompt([{ name: 'image1.jpg', path: '/path/to/image1.jpg' }]);