react-native-image-to-blob

0.0.6 • Public • Published

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

Package Sidebar

Install

npm i react-native-image-to-blob

Weekly Downloads

8

Version

0.0.6

License

MIT

Unpacked Size

5.69 kB

Total Files

6

Last publish

Collaborators

  • zusinshinpei