Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse multiple files #113

Open
nirclarity opened this issue Sep 4, 2024 · 1 comment
Open

Parse multiple files #113

nirclarity opened this issue Sep 4, 2024 · 1 comment

Comments

@nirclarity
Copy link

nirclarity commented Sep 4, 2024

Hi,
I'm using this library to stream large files into my GCS buckets, and it works great and is performant—thank you for that.
I was wondering if there is a possibility to be able to parse the Content-Disposition header in each part of the boundary to distinct chunks (or Targets) for each and each file that was sent. (via the filename in the header).
Browsers, and generally HTTP clients, support sending multiple files with the same form field name, and the only thing that can distinguish parts is the Content-Disposition header with filename; I believe this is logic that should be written in the cython module (?)

Update:
After some review for the _parser written in Cython, I was thinking to this approach:
Creating a CustomTarget that will handle separating files the moment there is a new multipart_filename,
What are you suggest?

    def on_data_received(self, chunk):
        print("chunk is related to this filename: ", self.multipart_filename)

But i'm afraid of bytes (or chunks) that there are bytes from the end of the previous file and starting a new file. (in the same chunk) I'm not sure how to handle this.

Any thoughts?
Thanks!

@siddhantgoel
Copy link
Owner

Hey, would you be able to post some example data received by the server for the case when there are multiple files attached for one input? I'd like to have this feature, and I think it should be possible. I'd like to see what the data looks like before suggesting an implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants