Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.76 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.76 KB

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',
    },
  });
}