Is there a version of ioutil.ReadAll
that will read until it reaches an EOF OR if it reads n
bytes (whichever comes first)?
I cannot just take the first n
bytes from an ioutil.ReadAll
dump for DOS reasons.
Is there a version of ioutil.ReadAll
that will read until it reaches an EOF OR if it reads n
bytes (whichever comes first)?
I cannot just take the first n
bytes from an ioutil.ReadAll
dump for DOS reasons.
io.ReadFull or io.LimitedReader or http.MaxBytesReader.
If you need something different first look at how those are implemented, it'd be trivial to roll your own with tweaked behavior.