Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ec15a30

Browse files
committed
docs(examples): fix _basics_ example
1 parent c24659c commit ec15a30

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

examples/basics/index-es6.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@
33
const fs = require('fs')
44
const os = require('os')
55
const path = require('path')
6-
// const IPFS = require('../../src/core')
6+
const IPFS = require('../../src/core')
77
// replace this by line below if you are using ipfs as a dependency of your
88
// project
9-
const IPFS = require('ipfs')
9+
// const IPFS = require('ipfs')
1010

1111
/*
1212
* Create a new IPFS instance, using default repo (fs) on default path (~/.ipfs)
1313
*/
1414
const node = new IPFS({
1515
repo: path.join(os.tmpdir() + '/' + new Date().toString()),
1616
init: false,
17-
start: false,
18-
EXPERIMENTAL: {
19-
pubsub: false
20-
}
17+
start: false
2118
})
2219

2320
const fileToAdd = {
@@ -37,16 +34,12 @@ node.version()
3734
/*
3835
* Initialize the repo for this node
3936
*/
40-
.then(() => {
41-
return node.init({ emptyRepo: true, bits: 2048 })
42-
})
37+
.then(() => node.init({ emptyRepo: true, bits: 2048 }))
4338

4439
/*
4540
* Take the node online (bitswap, network and so on)
4641
*/
47-
.then(() => {
48-
return node.start()
49-
})
42+
.then(() => node.start())
5043

5144
/*
5245
* Add a file to IPFS - Complete Files API on:
@@ -71,9 +64,7 @@ node.version()
7164
* Awesome we've added a file so let's retrieve and
7265
* display its contents from IPFS
7366
*/
74-
.then((fileMultihash) => {
75-
return node.files.cat(fileMultihash)
76-
})
67+
.then((fileMultihash) => node.files.cat(fileMultihash))
7768

7869
.then((stream) => {
7970
console.log('\nFile content:')
@@ -82,10 +73,6 @@ node.version()
8273
return Promise.resolve()
8374
})
8475

85-
.then(() => {
86-
console.log('Success!')
87-
})
76+
.then(() => console.log('Success!'))
8877

89-
.catch((err) => {
90-
console.log(err)
91-
})
78+
.catch((err) => console.log(err))

0 commit comments

Comments
 (0)