-
Notifications
You must be signed in to change notification settings - Fork 611
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
Last chunk is bigger then configured chunkSize #51
Comments
The reason for this is related to the (Resumable.js was originally written for us to handle video uploads to 23 Video and in those cases we actually review whether a file is a valid video file already when the first and last chunk are uploaded. For this, we need all meta data for the file to be available -- and not just a last bit of only a few bytes.) |
Guessed so and truly understand, as we're also handling video uploads / encoding for our service. Still, I think this should be more configurable. I don't think that I need 8MB of the file end for the proper (MOOV/id3 tag) detection. Also, this routine should only be enforced when |
I don't actually disagree about the configurability, but opted against it in the implementation -- for the simple reason that having it configurable on the frontend would also mean that it had to be configurable in any and all backend implementations (the node/express lib, the python/django lib, the php lib and so on). To me, this was too high a price to pay for the feature. As a side-note, you're absolute right: 8 MB chunks are probably too big; I usually opt for 1 MB chunks, making the trailing meta data chunk between one and two megs. |
I find this behavior highly confusing, too. Could you elaborate in which way this would have to be configured server-side? Wouldn't this be solvable by: I personally would opt for b) or c), but I'm sure there are many more possibilities to solve this. |
"Could you elaborate in which way this would have to be configured server-side?" Because the server needs to verify the chunk size -- so if the size varies by client-side configuration we would also need to have a server-side configuration. This is something to avoid. I agree with you that there are alternative defaults, but not that these would make enough of a difference to warrant breaking existing implementations of server-side implementations. |
I understand you don't want to break existing server-side implementations, could we add an opt-in to make this more sane (e.g |
We can change behaviour, sure -- but let me try to understand the issue in having a bigger-than- Originally, I reasoned that the *chunks are always |
The issue we are having specifically are a server-side enforcement of the maximum chunk size along with a chunk-based storage system with a fixed block size. Server-side chunk splitting or usage of a greater block size are unfortunately not possible. Alongside with that -- more ideologically -- you have to admit the current behavior is rather not what one would expect when explicitly setting a chunk size, don't you? |
Of course, you're exactly right about that. I agree that the original choice could have been made better; only question is whether the mistake is big enough to warrant breaking changes, or just needs better documentation. |
I don't understand. How would e.g. adding a |
That wouldn't be breaking, only question is whether to set it to |
When aiming for a logical future interface, I still think we should send the last chunk >=chunkSize only when |
Lets go with your suggestion. So:
Would you want to make the changes and send a pull request? |
See #56 |
Impressive work, however a very bad default behaviour regarding last |
It's a very important default for our use case -- we need a sizeable chunk of the file being uploaded to determine whether it's a supported video file. So wouldn't call it very bad. |
I do understand your use case, but this library is standalone and it seems unreasonable to have that behaviour as its default. I think the general idea is vice versa. |
Hi all. |
@pacificsoftdevld Please don't hijack other issues with unrelated comments (I can see you also created an issue, which is the right approach). |
While enforcing the maximum chunkSize on a Server-Side (node.js) I realized that the last chunk is often bigger than the configured chunkSize. The source code states this is how it is supposed to be at https://github.com/23/resumable.js/blob/master/resumable.js#L259
Why are we doing this? And if there is a good reason for it, shouldn't we mention the behavior in the documentation?
The text was updated successfully, but these errors were encountered: