Skip to content

Commit

Permalink
chore: new stream methods update
Browse files Browse the repository at this point in the history
  • Loading branch information
tomicvladan committed Feb 6, 2024
1 parent 590db65 commit 5ef2918
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ You can import the followings directly from `@fairdatasociety/bmt-js`:
* address() # gives back the calculated chunk address of file data
* span() # serialized span value of the file
* bmt() # gives back the Binary Merkle Tree of the file data
* ChunkedFileDeferred
* payload # the passed byte stream with which the object was initialized.
* leafChunks # data chunks stream of the file data
* rootChunk # promise that resolves topmost chunk in the file BMT
* address # promise of the calculated chunk address of file data
* bmt # stream of the Binary Merkle Tree of the file data (levels are separated by an empty chunk)
* ChunkInclusionProof # groups chunk inclusion proof segments and span value of a chunk
* ChunkAddress # chunk address resulted from BMT hashing of data. It is used also fole FileAddress
* Span # span value in byte format. Indicates how much data subsumed under the Chunk/File
Expand All @@ -85,6 +91,9 @@ You can import the followings directly from `@fairdatasociety/bmt-js`:
* getBmtIndexOfSegment # get the chunk's position of a given payload segment index in the BMT tree
* fileInclusionProofBottomUp # gives back required sister segments of a given payload segment index for inclusion proof
* fileAddressFromInclusionProof # gives back the file address that is calculated with only the inclusion proof segments and the corresponding proved segment and its position.
* makeChunkedFileWithStreams # makes `Chunk` helper object for performing BMT actions on file data using streams
* createBmtWithStreams # generates BMT chunks and outputs them to a readable stream.
* createBmtRootChunkWithStreams # calculates root chunk for bytes received by a readable stream

## Other objects

Expand Down
2 changes: 1 addition & 1 deletion src/file-streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function createBmtWithStreams<
}

/**
* Calculates root chunk for leaf chunks received by a readable stream
* Calculates root chunk for bytes received by a readable stream
* @param payload Readable stream of Uint8Array data
* @param payloadLength Total number of bytes in payload
* @param chunkStreamFactory A factory function for a readable stream
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export {
fileAddressFromInclusionProof,
getBmtIndexOfSegment,
} from './file'
export {
makeChunkedFileWithStreams,
createBmtWithStreams,
createBmtRootChunkWithStreams,
} from './file-streams'
export { Chunk, ChunkAddress, makeChunk, rootHashFromInclusionProof } from './chunk'
export { Span, makeSpan, getSpanValue } from './span'
export * as Utils from './utils'

0 comments on commit 5ef2918

Please sign in to comment.