react-native-image-to-blob

it can get Blob from image url

Usage no npm install needed!

<script type="module">
  import reactNativeImageToBlob from 'https://cdn.skypack.dev/react-native-image-to-blob';
</script>

README

react-native-image-to-blob

platforms npm npm github issues github closed issues Issue Stats

It can get blob from react native image uri.

That universal links can't get blob

  • rct-image-store
  • asset-library

Getting Started

npm install --save react-native-image-to-blob react-native-image-resizer
cd ios && pod install

Usage

// ImageType is from react-native-camera-roll's image return type
async function uploadPhoto(image: ImageType) {
  const imageFile = await imageToBlob(image);

  const formData = new FormData();
  formData.append('imageFile', imageFile);

  await fetch('https://your.server.url/upload/photo', {
    method: 'POST',
    body: formData,
    headers: {
      'Content-Type': 'multipart/form-data;charset=utf-8',
    },
  });
}