mirror of
https://github.com/logos-storage/logos-storage-js.git
synced 2026-01-04 06:23:06 +00:00
various small README and comment fixes (#10)
* various small README and comment fixes * add async/sync variants with comments
This commit is contained in:
parent
f77978cd63
commit
5d2f3f6603
24
README.md
24
README.md
@ -55,7 +55,7 @@ const codex = new Codex("http://localhost:3000");
|
|||||||
To use a module, you need to use the await syntax. If the module is not loaded yet, it will be imported first and then cached in memory.
|
To use a module, you need to use the await syntax. If the module is not loaded yet, it will be imported first and then cached in memory.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const marketplace = await codex.marketplace;
|
const marketplace = await codex.marketplace();
|
||||||
```
|
```
|
||||||
|
|
||||||
### Error handling
|
### Error handling
|
||||||
@ -97,7 +97,11 @@ The following API assume that you have already a marketplace module loaded, exam
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const codex = new Codex("http://localhost:3000");
|
const codex = new Codex("http://localhost:3000");
|
||||||
|
// When using the async api
|
||||||
const marketplace = await codex.marketplace();
|
const marketplace = await codex.marketplace();
|
||||||
|
|
||||||
|
// When using the sync api
|
||||||
|
const marketplace = codex.marketplace
|
||||||
```
|
```
|
||||||
|
|
||||||
#### activeSlots()
|
#### activeSlots()
|
||||||
@ -241,7 +245,11 @@ The following API assume that you have already a data module loaded, example:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const codex = new Codex("http://localhost:3000");
|
const codex = new Codex("http://localhost:3000");
|
||||||
const data = await codex.data;
|
// When using the async api
|
||||||
|
const data = await codex.data();
|
||||||
|
|
||||||
|
// When using the sync api
|
||||||
|
const data = codex.data
|
||||||
```
|
```
|
||||||
|
|
||||||
#### cids
|
#### cids
|
||||||
@ -342,7 +350,11 @@ The following API assume that you have already a node module loaded, example:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const codex = new Codex("http://localhost:3000");
|
const codex = new Codex("http://localhost:3000");
|
||||||
const data = await codex.debug;
|
// When using the async api
|
||||||
|
const data = await codex.debug();
|
||||||
|
|
||||||
|
// When using the sync api
|
||||||
|
const data = codex.debug
|
||||||
```
|
```
|
||||||
|
|
||||||
#### setLogLevel
|
#### setLogLevel
|
||||||
@ -376,7 +388,11 @@ The following API assume that you have already a node module loaded, example:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const codex = new Codex("http://localhost:3000");
|
const codex = new Codex("http://localhost:3000");
|
||||||
const node = await codex.node;
|
// When using the async api
|
||||||
|
const node = await codex.node();
|
||||||
|
|
||||||
|
// When using the sync api
|
||||||
|
const node = codex.node
|
||||||
```
|
```
|
||||||
|
|
||||||
#### spr
|
#### spr
|
||||||
|
|||||||
@ -127,8 +127,8 @@ export class CodexData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download a file from the network in a streaming manner.
|
* Download a file from the network to the local node if it's not available locally.
|
||||||
* If the file is not available locally, it will be retrieved from other nodes in the network if able.
|
* Note: Download is performed async. Call can return before download is completed.
|
||||||
*/
|
*/
|
||||||
async networkDownload(cid: string): Promise<SafeValue<NetworkDownloadResponse>> {
|
async networkDownload(cid: string): Promise<SafeValue<NetworkDownloadResponse>> {
|
||||||
const url = this.url + Api.config.prefix + `/data/${cid}/network`;
|
const url = this.url + Api.config.prefix + `/data/${cid}/network`;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user