Skip to content

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

Notifications You must be signed in to change notification settings

blazerroadg/react-native-azure-blob-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Step 2 Dependencies

npm install --save react-native-background-upload

iOS

cd ios
pod install

Manual Installation

please follow each dependensy document :

Usage

Import library

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

init azure blob storage setting

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

upload file from cameraroll :

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);

  }

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published