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
[BUG] .size option is broken #1
Comments
Hm... I do actually (in npm) have some use cases where I want to fetch something, and know the exact size ahead of time, so anything larger or smaller than that size is an error. It doesn't look like Would you be happy if |
Hmm... Not sure if that would be the best, because node-fetch uses Maybe it would be better if the current "exact size" option was moved to another option. Or maybe a new option could let the user decide how it should behave. (A |
Well, this is a reimplementation/fork of node-fetch, but I think in terms of intended API, they're both aiming to be an implementation of the WhatWG But you do make a good point, it would be simpler to switch back and forth between them if the options that do exist in both had the same semantics. And node-fetch came first. Ok, I'm convinced. In the use case where I'm passing |
I also just hit the same issue as I was expecting that |
What
It seems that when the
.size
option is used,minipass-fetch
expects the body size to be exactly equal to it, whereasnode-fetch
expects the body size to be lower.This makes the option quite useless as it cannot be used to limit size. You can only use it if you know the exact body size in advance.
When
Where
This is my config:
How
Steps to Reproduce
Current Behavior
Expected Behavior
If
node-fetch
is required instead, the source code of https://example.org is printed..size should be a size limit.
minipass-fetch
should accept smaller sizes and abort the download as soon as the limit is crossed.The text was updated successfully, but these errors were encountered: