react-native-image-resizer
react-native-image-resizer copied to clipboard
How to get filesize byte ?
I want to resize image. If image file size > 5 mb
I can get width and height but iI don’t know How to get filesize (byte)?
Thank you 😣
You could use react-native-file-fs to look up the stat(istics) of the file, and check the size property which returns the number of bytes.
const input: string = "file://...";
const {size} = await RNFS.stat(input);
if (size > 5000000) {
// resize the source image
ImageResizer.createResizedImage(...)
}
If you're already resizing the image, react-native-image-resizer returns the size property from createResizedImage already.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Thank you for your contributions.