I'm working on a react native application which fetches image from URL and saves in local device.
const getExtention = (filename) => {
return /[.]/.exec(filename) ? /[^.]+$/.exec(filename) : undefined;
};
I'm using the above code for getting image extension for this kind of files. https://upload.wikimedia.org/wikipedia/commons/4/41/Sunflower_from_Silesia2.jpg
But there are also some image urls available without extension like below
https://media.gettyimages.com/photos/woman-lifts-her-arms-in-victory-mount-everest-national-park-picture-id507910624?s=612x612
so how can i know what extension theabove image is ? to store in device