How to limit the size of each read from a ReadableStream

Im Accessing a file from my device storage using HTML file input then I read that file as a stream.

  • Is there any built-in way to limit the length of each read to specific number of bytes.
const stream = myFile.stream() 
const reader = stream.getReader();

//actually I use this each time I want to read more data from the stream
reader.read().then(function({ done, value }) { 
  
    const bufferSizeInBytes = value.length //  I want to limit this to 1000 bytes as max value
   
    })

Another question that’s confusing me, why do we get different size of the buffer on each read, does it depend on the available memory or cpu or how does it actually work? if it depends on the memory we would be able to read the whole stream in one single read since the file is around 100 mb and my available memory is around 6GB , but actually it took many reads what made me think that the memory is not the only factor behind this operation.

any help would be much appreciated.