mirror of
https://github.com/fluencelabs/aqua-ipfs
synced 2025-03-15 13:10:49 +00:00
Add quick installation and example
This commit is contained in:
parent
e0a8abc1ac
commit
fb00b33b68
27
README.md
27
README.md
@ -1,8 +1,33 @@
|
|||||||
# Aqua IPFS bindings
|
# Aqua IPFS bindings
|
||||||
Native IPFS integration to Aqua language. Orchestrate IPFS file transfer with Aqua scripts.
|
Native IPFS integration to Aqua language. Orchestrate IPFS file transfer with Aqua scripts.
|
||||||
|
|
||||||
|
## Quick installation with @fluencelabs/cli
|
||||||
|
```
|
||||||
|
fluence dep npm i @fluencelabs/aqua-ipfs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick Aqua example
|
||||||
|
|
||||||
|
```
|
||||||
|
import "@fluencelabs/aqua-ipfs/ipfs-api.aqua"
|
||||||
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
|
|
||||||
|
const PERIOD_SEC = 10
|
||||||
|
|
||||||
|
func install_scheduled_script_from_ipfs_to_peer(from: PeerId, to: PeerId, cid: string) -> ?string:
|
||||||
|
script_id: ?string
|
||||||
|
|
||||||
|
ipfs_maddr <- get_external_api_multiaddr(from)
|
||||||
|
if ipfs_maddr.success:
|
||||||
|
get <- get_from(to, cid, ipfs_maddr.multiaddr)
|
||||||
|
if get.success:
|
||||||
|
script_id <- Script.add_from_vault(get.path, ?[PERIOD_SEC])
|
||||||
|
|
||||||
|
<- script_id
|
||||||
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
See [Aqua Book](https://fluence.dev/aqua-book/libraries/aqua-ipfs).
|
See [aqua-ipfs in Aqua Book](https://fluence.dev/docs/aqua-book/libraries/aqua-ipfs).
|
||||||
|
|
||||||
## How to use it in TypeScript
|
## How to use it in TypeScript
|
||||||
There's a simple example in [example](/example/index.ts)
|
There's a simple example in [example](/example/index.ts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user