小编Luf*_*tre的帖子

获取 API 等待已定义块大小的块

我想获取一个 URL 并按定义大小的块处理响应。我也不想在等待整个块可用时阻塞。Fetch API 中有类似的功能吗?

示例如下:

const response = await fetch(url)
const reader = response.body.getReader()
const chunk = await reader.read(CHUNK_SIZE) 

Run Code Online (Sandbox Code Playgroud)

javascript asynchronous fetch fetch-api

2
推荐指数
1
解决办法
4481
查看次数

标签 统计

asynchronous ×1

fetch ×1

fetch-api ×1

javascript ×1