Skip to content

Instantly share code, notes, and snippets.

@jjylik
Last active November 12, 2022 15:25
Show Gist options
  • Save jjylik/b9ca27f6abf4fcc91dc89df294c60a99 to your computer and use it in GitHub Desktop.
Save jjylik/b9ca27f6abf4fcc91dc89df294c60a99 to your computer and use it in GitHub Desktop.
Local fetch gives "wrong" number of bytes in iOS
//react-native-fs
const imagePath = '/somewhere/image.jpeg';
const imageFile = await RNFS.stat(imagePath)
const response = await fetch('file://'+imagePath);
const imageBody = await response.blob();
// Android returns true, iOS false :/
console.log(imageBody.size === imageFile.size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment