GithubHelp home page GithubHelp logo

Comments (8)

iMacTia avatar iMacTia commented on June 15, 2024

Hi @triplef, I'm afraid this might not be in the multipart middleware capabilities at the moment.
Just to understand, is the server expecting multiple individual requests (each on a separate connection), or is this supposed to be a streaming request (single connection reused for many requests)?

Also, I'll move this ticket under the new faraday-multipart repository since that's where the middleware lives now, you might get a few notifications from GitHub 😄

from faraday-multipart.

triplef avatar triplef commented on June 15, 2024

Thanks for your feedback! I’m not sure there’s a requirement regarding reusing the connection, I’m guessing it should work either way but I’d probably try to reuse first.

Do you happen to know of any other project that might be able to do this?

from faraday-multipart.

iMacTia avatar iMacTia commented on June 15, 2024

I mostly work with AWS and use their sdk when I need something plug-and-play. So I made a quick search and found that Azure offers something similar in Ruby: https://github.com/azure/azure-storage-ruby

It would make sense to use that instead of re-implementing it using Faraday. What do you think?

from faraday-multipart.

triplef avatar triplef commented on June 15, 2024

Yeah that makes a lot of sense and I looked into this, unfortunately that SDK doesn’t seem to have the necessary initializers to work with an externally provided URL for our use case (see Azure/azure-storage-ruby#211).

I’ll see if I can get more info there or find some other way. Thanks again!

from faraday-multipart.

iMacTia avatar iMacTia commented on June 15, 2024

I may be wrong, but I suspect they're simply lacking documentation around it. Looking at the BlobService code, I found a reference to a storage_sas_token. It seems like the initializer accepts many more options than what is shown in the README.md. Is that still not enough to achieve what you need? (Sorry, I'm just trying to help but I know close to zero about Azure 😅)

from faraday-multipart.

iMacTia avatar iMacTia commented on June 15, 2024

I forgot the link to the reference obviously 🤦 : https://github.com/Azure/azure-storage-ruby/blob/master/blob/lib/azure/storage/blob/blob_service.rb#L56

from faraday-multipart.

triplef avatar triplef commented on June 15, 2024

I still don’t see a way to give it a full URI (the URI seems to be always built from individual components, see blob_uri), but I found another solution: Setting a header like x-ms-version: 2021-02-12 increases the maximum blob size to 5 GiB, which is more than enough for our purposes.

So I ended up with the following:

filePart = Faraday::FilePart.new(filePath, 'application/octet-stream')
Faraday.new(headers: {
  'x-ms-blob-type': 'BlockBlob',
  'x-ms-version': '2021-02-12'
}) {|c|
  c.response :raise_error
  c.adapter Faraday.default_adapter
}.put(fileUploadUrl, filePart, {'Content-Length': filePart.size.to_s})

Thanks again for your help!

from faraday-multipart.

iMacTia avatar iMacTia commented on June 15, 2024

Thanks for coming back and sharing your solution! I'm sure that will help others in future ❤️

from faraday-multipart.

Related Issues (5)

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.