An open API service indexing awesome lists of open source software.

https://github.com/blazerroadg/react-native-azure-blob-storage

This package help you to upload file and assets from react native project to your azure blob storage service
https://github.com/blazerroadg/react-native-azure-blob-storage

azure-blob azure-blob-storage blob react-native upload upload-file upload-images

Last synced: 4 months ago
JSON representation

This package help you to upload file and assets from react native project to your azure blob storage service

Awesome Lists containing this project

README

        

# react-native-azure-blob-storage-manager
This package help you to upload file and assests from react native project to your azure blob storage service

# Install

## Step 1

```bash
npm i react-native-azure-blob-storage-manager --save
```

## Step 2 Dependencies
```bash
npm install --save react-native-background-upload
```

### iOS

```bash
cd ios
pod install
```

# Manual Installation
please follow each dependensy document :

- https://github.com/Vydia/react-native-background-upload

## Usage

Import library

```javascript
import { azureblobfetch, initAzureBlob } from 'react-native-azure-blob-storage-manager/azurblobstorage'
import Upload from 'react-native-background-upload'
```

init azure blob storage setting

```javascript
constructor(props) {
super(props);
initAzureBlob(
{
storageKey: `${YOUR_BLOB_STORAGE_SECRET_KEY}`,
account: `${YOUR_ACCOUNT_NAME}`,
version: '2018-03-28'
})
....
}
```

upload file from cameraroll :
```javascript
uploadAzure = async (assest) => {
const res = await azureblobfetch({
assest: assest,
container: "images" //your countainer name,
filenameprefix: "test" //add before the autogenrated file name,
type: 'Upload'
})
Upload.addListener('progress', res.uploadId, (data) => {
console.log(`Progress: ${data.progress}% `)
})
Upload.addListener('cancelled', res.uploadId, (data) => {
console.log(`Cancelled!`)
})
Upload.addListener('completed', res.uploadId, (data) => {
// data includes responseCode: number and responseBody: Object
console.log(data)
})
console.log(res);

}
```