textiot
Version:
A framework for building web and native (IoT) Dapps on the IPFS network
52 lines (51 loc) • 1.35 kB
TypeScript
import { ISwarmPeerList } from './model';
/**
* Get node's IPFS peerId.
* ```typescript
* Textile.ipfs.peerId();
* ```
*/
export declare function peerId(): Promise<string>;
/**
* Open a new direct connection to a peer using an IPFS multiaddr
* ```typescript
* Textile.ipfs.connect(multiaddr);
* ```
*/
export declare function connect(multiaddr: string): Promise<boolean>;
/**
* Request all Peers to which this node is connected.
* ```typescript
* Textile.ipfs.peers(verbose, latency, streams, direction);
* ```
*/
export declare function peers(verbose?: boolean, latency?: boolean, streams?: boolean, direction?: boolean): Promise<ISwarmPeerList>;
/**
* Get raw file data by IPFS path. See `cat` method in IPFS.
* ```typescript
* Textile.ipfs.dataAtPath(path);
* ```
*/
export declare function dataAtPath(path: string): Promise<{
data: Uint8Array;
mediaType: string;
}>;
/**
* Publishes a message to a given pubsub topic
* ```typescript
* Textile.ipfs.pubsubPub(topic, data);
* ```
*/
export declare function pubsubPub(topic: string, data: string | object): Promise<string>;
/**
* Subscribes to messages on a given topic
* ```typescript
* Textile.ipfs.pubsubSub(topic);
* ```
*/
export declare function pubsubSub(topic: string): Promise<{
queryId: string;
queryHandle: {
close: () => void;
};
}>;