🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@cuser/reader

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cuser/reader

messages reader from the ipfs transport layer

latest
Source
npmnpm
Version
0.0.36
Version published
Maintainers
1
Created
Source

cuser logo

Status

codecov npm npm-downloads

Class: CuserReader

Hierarchy

  • CuserReader

Index

Constructors

Methods

Constructors

constructor

+ new CuserReader(core: CuserCore, peerId: string | Promise<string>, opts?: CuserReaderOptions): CuserReader

Defined in reader/reader.js:32

Parameters:

NameTypeDefault value
coreCuserCore-
peerIdstring | Promise<string>-
optsCuserReaderOptions{}

Returns: CuserReader

Methods

_resolveRootMessage

Private_resolveRootMessage(topicId: string): Promise<string>

Defined in reader/reader.js:118

Get the root message for a certain topicId

Parameters:

NameType
topicIdstring

Returns: Promise<string>

getMessage

getMessage(cid: string): Promise<GraphMessage>

Defined in reader/reader.js:108

Gets the message from ipfs using the CID given by parameter

Parameters:

NameType
cidstring

Returns: Promise<GraphMessage>

getMessages

getMessages(topicId: string, opts: CuserReaderMessagesIteratorOptions): Promise<CuserReaderMessageIteratorResult[]> | AsyncIterable<CuserReaderMessageIteratorResult>

Defined in reader/reader.js:76

Gets messages from ipfs layer

example

Array

const messages = reader.getMessages('custom_topic_id');
console.log(messages);

Iterator

const messages = reader.getMessages('custom_topic_id', {
  iterator: true,
});
for await (let value of messages) {
  console.log(value);
}

Parameters:

NameType
topicIdstring
optsCuserReaderMessagesIteratorOptions

Returns: Promise<CuserReaderMessageIteratorResult[]> | AsyncIterable<CuserReaderMessageIteratorResult>

FAQs

Package last updated on 24 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts