Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

The Next API #52

Description

@mikeal

After @vmx and I had a talk about what the next iteration of the format API should look like it occurred to me that it’s about time for us to start writing all of this out and discussing it.

Here’s an outline of my ideas for the next API iteration.

serialize(native Object)

Returns a Promise that resolves to an IPLD Block instance.

toBlock(binary Blob)

Returns a Promise that resolve to an IPLD Block instance.

reader(IPLD Block Instance)

Returns an implementation of the Reader interface 👇🏼

Reader.get(path)

Returns a Promise that resolves to an object in the following format.

{ value: ‘some value’ }
// or
{ link: CID Instance,
  remaining: ‘some/path’
}
// or
{ link: CID Instance }

Reader.links()

Returns an async iterator of all the links in the block as instances of CID.

Reader.tree()

Returns an async iterator of all the paths available in the block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions