How to implement max download size with `got`

from blog Alex W.'s Blog, | ↗ original
The sindresorhus/got documentation provides a hooks based approach which can be found at Advanced Creation: Limiting Download & Upload Size. You can also use got.stream(...) to implement this functionality in a manner that avoids any response body download if the content-length header indicates that the download will be too large (the sample in...