ipfs-demo 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/README.md +21 -15
  2. package/index.js +19 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,24 +1,30 @@
1
1
 
2
2
  # IPFS implementations
3
3
  ```javascript
4
- import {create} from 'ipfs-https-client'
5
- const ipfsClient = async () =>{
6
- const options ={
7
- host:'ipfs.infura.io',
8
- port:5001,
9
- protocol:'https',
10
-
11
- }
12
- const ipfs = await create(options);
13
- return ipfs;
4
+ const {create}= require('ipfs-http-client')
5
+ const ipfsClient = async () =>{
6
+ const options ={
7
+ host:'ipfs.infura.io',
8
+ port:5001,
9
+ protocol:'https',
10
+
11
+ }
12
+ const ipfs = await create(options);
13
+ return ipfs;
14
14
 
15
- }
15
+ }
16
16
 
17
- ( async function(){
18
-
17
+ ```
18
+ ***
19
+ ## function expression implementation (IIF)
20
+ ---
21
+ ``` javascript
22
+
23
+ ( async function(){
24
+
19
25
  const addText = await ipfsClient();
20
26
  const storeResult = await addText.add('npm package manager')
21
27
  console.log(storeResult)
22
-
23
- })()
28
+
29
+ })()
24
30
  ```
package/index.js CHANGED
@@ -1,16 +1,20 @@
1
- const { create } = require("ipfs-http-client");
2
- const ipfsClient = async () => {
3
- const ipfs = await create({
4
- host: "ipfs.infura.io",
5
- port: 5001,
6
- protocol: "https",
7
- });
8
- return ipfs;
9
- };
10
- const addText = async () => {
11
- const ipfs = await ipfsClient();
12
- const saveData = await ipfs.add(JSON.stringify({ name: "sharvan" }));
13
- console.log(saveData)
14
- };
1
+ const {create}= require('ipfs-http-client')
2
+ const ipfsClient = async () =>{
3
+ const options ={
4
+ host:'ipfs.infura.io',
5
+ port:5001,
6
+ protocol:'https',
7
+
8
+ }
9
+ const ipfs = await create(options);
10
+ return ipfs;
15
11
 
16
- addText()
12
+ }
13
+
14
+ ( async function(){
15
+
16
+ const addText = await ipfsClient();
17
+ const storeResult = await addText.add('npm package manager')
18
+ console.log(storeResult)
19
+
20
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipfs-demo",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "dependencies": {