@ipld/car -carreader用于大文件(内容地址为存档)
我正在尝试使用@ipld/car
从.car文件(内容地址存档)创建读者。该文档显示了如何创建carreader
当文件较小时,如下所示:
import { CarReader } from '@ipld/car'
const inStream = fs.createReadStream('example.car');
// read and parse the entire stream in one go, this will cache the contents of
// the car in memory so is not suitable for large files.
const reader = await CarReader.fromIterable(inStream);
问题:如果我有一个文件c:\ output.car
,则说10GB并且比我可用的RAM更大,如何为此大型.car
文件创建读者?
我认为这应该是这些方法之一,但是没有关于如何使用它的示例代码...
import { CarBlockIterator } from '@ipld/car/iterator';
// or
import { CarCIDIterator } from '@ipld/car/iterator';
I'm trying to create a reader from a .car file (Content Addressed Archive) using @ipld/car
. The documentation shows how to create a carReader
when files are small as per below:
import { CarReader } from '@ipld/car'
const inStream = fs.createReadStream('example.car');
// read and parse the entire stream in one go, this will cache the contents of
// the car in memory so is not suitable for large files.
const reader = await CarReader.fromIterable(inStream);
Question: If I have a file at C:\output.car
, and it's say 10GB and larger than my available RAM, how can I create a reader for this large .car
file?
I think it should be one of these methods, but there's no sample code on how to use it...
import { CarBlockIterator } from '@ipld/car/iterator';
// or
import { CarCIDIterator } from '@ipld/car/iterator';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
弄清楚了。这有效:
Figured it out. This works: