Content addressable graph where every node has at most a single link to another node
npm install subgraph
var subgraph =var sg =var ws = sgwswsws
Create a new subgraph instance. Options include:
Create an append stream. The values you write to it will be linked together.
When the stream emits
finish it will have a
.key property that contains the latest link
.length property that contains the number of nodes written
Optionally you can provide a
link in the constructor for the first node to append to.
Create a read stream from a key. Will read out values in reverse order of writes to the append stream.
Create a write stream from a key. Will verify that the values written matches the key when hashed.
Shorthand for only adding a single value
Shorthand for getting a single value
Returns the root of a stream. If a write stream was ended prematurely / destroyed the root returned will have a link property.