Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Support node's ReadStream in ipfs.add instead of AsyncIterable<Uint8Array> / Iterable<Uint8Array> #3188

@Gozala

Description

@Gozala

This is a followup to #3167. I have proposed to simplify ipfs.add even further by removing Iterable<Uint8Array> and AsyncIterable<Uint8Array> from the list of possible input types.

As per #3167 (comment) (quoted bolew for convenience)

We support AsyncIterable in order to support adding node streams:

 const fs = require('rs')
 ipfs.add(fs.createReadStream('/path/to/file'))

We could get rid of Iterable<Uint8Array>|AsyncIterable<Uint8Array> and still support above use case, by adding node ReadStream (which is what fs.createReadStream returns) to the list of accepted options.

That would significantly reduce complexity of the normaliseInput and wire protocol encoder used in the #3022, but more importantly it remove mental overhead of the API and all the false positives that can occur when probing inputs.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions