Comments (4)
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 size
is in the WhatWG fetch() spec, so both node-fetch and minipass-fetch are sort of forging their own path here.
Would you be happy if minipass-fetch
provided a maxSize
option to set a maximum, and left size
to be "it must be this exact size"?
from minipass-fetch.
Hmm... Not sure if that would be the best, because node-fetch uses size
as the max size, and this package is meant to be a reimplementation of node-fetch.
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 .strictSize
boolean?) 🤔
from minipass-fetch.
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 fetch()
spec for Node.js. And WhatWG fetch()
doesn't have a size
option at all, so this is an extension of the spec either way. We're not strictly committed to matching node-fetch in every point. For example, minipass-fetch supports a trailers promise, which was dropped from the spec due to a lack of browser commitment, and never made it into node-fetch. (I might opt to drop it from minipass-fetch, since it's pretty niche anyway, but for now it's not hurting anyone.)
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 size
, it also passes size
to cacache (where it does mean "exact size") so any errors on that will get caught, just in a different spot.
from minipass-fetch.
I also just hit the same issue as I was expecting that size
would limit the maximum size allowed to be returned.
from minipass-fetch.
Related Issues (13)
- [QUESTION] Encoding used as dependency ? HOT 1
- feature request: Get multi-value headers as an array (for set-cookie) HOT 2
- Does not work via npm with NODE_EXTRA_CA_CERTS configured HOT 2
- [BUG] minipass-fetch is not aware of NODE_TLS_REJECT_UNAUTHORIZED HOT 1
- [BUG] Max timeout cannot be increased HOT 1
- [BUG] data urls are not handled properly
- [QUESTION] How soon will 1.4.2 be released?
- Potential security issue HOT 3
- [BUG] <unable to get local issuer certificate> HOT 1
- [BUG] Not Respecting NODE_TLS_REJECT_UNAUTHORIZED = 0 HOT 12
- test is getting 429 from github.com causing flakiness
- Reporting a vulnerability HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minipass-fetch.