如何增加节点应用程序中的标头大小

问题描述 投票:0回答:1

我正在创建一个节点应用程序来读取包含 50k 行的 csv 文件。每行由一个计数器、一个 slug 和一个类别组成。从这个文件中,我获取 slug 并调用 fetch URL 并获取 json 对象。 使用 fs 读取文件并将其作为对象返回。只是获取索引并返回。

之后我使用 this for 来迭代对象。

for (const [index, { slug }] of slugs.entries())

在for中我基本上只是做api fetch

    const apiUrl = `${BASE_URL}/${slug}`;

    const response = await fetch(apiUrl);
    const data = await response.json();

并使用其他函数处理数据,以便我已准备好将数据发布到另一个 api。

就像我提到的,我需要对 50k-250k slugs 执行此操作,但在 60 后出现以下错误。

FetchError: request to https://api.com/article/best-internet-providers failed, reason: Parse Error: Header overflow

有没有办法增加标题大小?我有 64GB 内存可用于运行该程序。还运行 Windows 11。

node.js node-modules fetch-api
1个回答
0
投票

要接受更大的标头,请在命令行上使用 --max-http-header-size 。如果您收到“Node: bad option: --max-http-header-size”,请升级到 Node v10.15.0 或更高版本

© www.soinside.com 2019 - 2024. All rights reserved.