Giter Site home page Giter Site logo

Comments (5)

XiaoningLiu avatar XiaoningLiu commented on May 28, 2024 1

Thanks for sharing : )

We are working on further reducing the bundle size in next release, should largely reducing the frontend bundled js size then.

from azure-storage-js.

XiaoningLiu avatar XiaoningLiu commented on May 28, 2024

@bearcanrun

The browser functions are commented out because we cannot run both Node.js and browser functions within one file, so commented out them in Node.js runtime.

I think the 3rd parameter is wrong, you need put a BlockBlobURL instead of BlobURL into uploadBrowserDatatoBlockBlob().

BlockBlobURL, PageBlobURL and AppendBlobURL extend from BlobURL. You need a child object instead of parent : )

  const blockBlobURL = azblob.BlockBlobURL.fromBlobURL(blobURL);

from azure-storage-js.

bearcanrun avatar bearcanrun commented on May 28, 2024

Thank you! I somehow overlooked the BlockBlobURL vs BlobURL. My final working code is:

import * as Azure from '@azure/storage-blob'

async uploadImage (sasURL, containerName, imgBlob) {
    const pipeline = Azure.StorageURL.newPipeline(new Azure.AnonymousCredential())
    const serviceURL = new Azure.ServiceURL(sasURL, pipeline)
    const containerURL = Azure.ContainerURL.fromServiceURL(serviceURL, containerName)
    const blockBlobURL = Azure.BlockBlobURL.fromContainerURL(containerURL, fileName)
    const uploadImage = await Azure.uploadBrowserDataToBlockBlob(Azure.Aborter.None, imgBlob, blockBlobURL)
    return uploadImage
  }

from azure-storage-js.

XiaoningLiu avatar XiaoningLiu commented on May 28, 2024

@bearcanrun Really glad to know it works! Just an investigation, are you using this SDK with which platform or tools? Such as, Angular, Webpack, browserify or rollup?

from azure-storage-js.

bearcanrun avatar bearcanrun commented on May 28, 2024

@XiaoningLiu Yes, I'm using it with nodejs backend GraphQL server + frontend React. Main tools are Webpack4, Nodejs, Express, Apollo GraphQL, and React.

from azure-storage-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.