Introduce fileSizeBytes config #11430
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuing the dependency audit started in #11425.
We use the
bytesdependency in a single place, to convert strings specified infetchLimitfrom a10MBto a number of bytes. The vast majority of users never care about this parameter, given it only affects self-hosted Shields instances, most of which will leave the default value anyway.In addition to the superfluous dependency, validation, and parsing,

bytes()has two function aliases, one that converts numbers to strings and one that converts strings to numbers. IDEs get confused and assume we're converting from number to string even though we're doing the opposite. In got.js, the typechecker mistakenly thinks we're comparing a number to a (potentially null) string, which is confusing:I propose the following course of action:
fetchLimitBytesconfig that behaves the same way asfetchLimit, but with a bytes value directly specified as a number. If anyone has overridden the value offetchLimit, they will get a warning when starting up the server, otherwise the newfetchLimitBytesdefault will be used.fetchLimitand and error out if someone still has it overridden in their config.Let me know what you think and whether it's worth it!