У вас отпечатка в имени функции 😆
async function* getGalleryFiles() {
var i = 0;
for(const { src } of document.getElementById("gallery").children) {
const response = await fetch(src);
const blob = await response.blob();
const file = new File(
[blob],
`file_${i}.${GetFileName(src)}`,
{ type: `image/${GetDataType(src)}` }
);
yield file;
i++;
}
}
Работает так (например, вывод в консоль)
for await(const file of getGalleryFiles()) {
console.log(file);
}
UPD Ещё
childNodes заменил на
children, вам нужны только HTML элементы, а не тексты, комментарии! 💯