readableStreamBYOBReader.read(view)
-
view
<Buffer> | <TypedArray> | <DataView> -
返回:用对象实现的 promise:
¥Returns: A promise fulfilled with an object:
-
value
<ArrayBuffer> -
done
<boolean>
-
从底层 <ReadableStream> 请求下一个数据块,并返回一个 promise,一旦数据可用,该 promise 就会实现。
¥Requests the next chunk of data from the underlying <ReadableStream> and returns a promise that is fulfilled with the data once it is available.
不要将池化的 <Buffer> 对象实例传递给此方法。池化的 Buffer
对象是使用 Buffer.allocUnsafe()
或 Buffer.from()
创建的,或者通常由各种 node:fs
模块回调返回。这些类型的 Buffer
使用共享的底层 <ArrayBuffer> 对象,该对象包含来自所有池化的 Buffer
实例的所有数据。当 Buffer
、<TypedArray> 或 <DataView> 传递给 readableStreamBYOBReader.read()
时,视图的底层 ArrayBuffer
被分离,使该 ArrayBuffer
上可能存在的所有现有视图无效。这可能会给你的应用带来灾难性的后果。
¥Do not pass a pooled <Buffer> object instance in to this method.
Pooled Buffer
objects are created using Buffer.allocUnsafe()
,
or Buffer.from()
, or are often returned by various node:fs
module
callbacks. These types of Buffer
s use a shared underlying
<ArrayBuffer> object that contains all of the data from all of
the pooled Buffer
instances. When a Buffer
, <TypedArray>,
or <DataView> is passed in to readableStreamBYOBReader.read()
,
the view's underlying ArrayBuffer
is detached, invalidating
all existing views that may exist on that ArrayBuffer
. This
can have disastrous consequences for your application.