This repository was archived by the owner on Sep 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,24 @@ npm install ipfs-log ipfs
92
92
Run a simple program:
93
93
94
94
``` javascript
95
- const IPFS = require (' ipfs' )
96
- const Log = require (' ipfs-log' )
97
- const IdentityProvider = require (' orbit-db-identity-provider' )
98
-
99
- const identity = await IdentityProvider .createIdentity ({ id: ' peerid' })
100
- const ipfs = new IPFS ()
101
- const log = new Log (ipfs, identity)
102
-
103
- ipfs .on (' ready' , async () => {
104
- await log .append ({ some: ' data' })
105
- await log .append (' text' ))
106
- console .log (log .values .map (e => e .payload ))
107
- })
95
+
96
+ // For js-ipfs >= 0.38
97
+
98
+ const Log = require (" ipfs-log" );
99
+ const IdentityProvider = require (" orbit-db-identity-provider" );
100
+ const IPFS = require (" ipfs" );
101
+
102
+ const start = async () => {
103
+ const identity = await IdentityProvider .createIdentity ({ id: " peerid" });
104
+ const ipfs = await IPFS .create ({ repo: " ./path-for-js-ipfs-repo" });
105
+ const log = new Log (ipfs, identity);
106
+
107
+ await log .append ({ some: " data" });
108
+ await log .append (" text" );
109
+ console .log (log .values .map ((e ) => e .payload ));
110
+ };
111
+
112
+ start ();
108
113
109
114
// [ { some: 'data' }, 'text' ]
110
115
```
You can’t perform that action at this time.
0 commit comments