Skip to content

Commit 02cb6f1

Browse files
committed
fix: lint works. removed ipfs-http-client in examples
1 parent c61331d commit 02cb6f1

File tree

4 files changed

+26
-39
lines changed

4 files changed

+26
-39
lines changed

examples/electron-asar/app.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
/* eslint no-console: 0 */
2-
'use strict'
3-
2+
// @ts-check
43
const electron = require('electron')
4+
const { path } = require('kubo')
5+
const { create } = require('kubo-rpc-client')
6+
/**
7+
* @type {import('../../src')}
8+
*/
9+
const { createNode, createServer } = require('../../src')
510
const app = electron.app
611
const ipcMain = electron.ipcMain
712
const BrowserWindow = electron.BrowserWindow
813

9-
const { createController, createServer } = require('ipfsd-ctl')
10-
1114
app.on('ready', () => {
1215
const win = new BrowserWindow({
1316
title: 'loading',
@@ -23,17 +26,17 @@ ipcMain.on('start', async ({ sender }) => {
2326
sender.send('message', 'starting disposable IPFS')
2427
try {
2528
const s = createServer({
26-
host: '127.0.0.1',
2729
port: 43134
2830
}, {
29-
type: 'go',
30-
ipfsBin: require('go-ipfs').path(),
31-
ipfsHttpModule: require('ipfs-http-client')
31+
type: 'kubo',
32+
rpc: create,
33+
bin: path()
3234
})
3335
await s.start()
34-
const node = await createController({
35-
type: 'go',
36-
ipfsHttpModule: require('ipfs-http-client')
36+
const node = await createNode({
37+
type: 'kubo',
38+
rpc: create,
39+
bin: path()
3740
})
3841
console.log('get id')
3942
sender.send('message', 'get id')

examples/electron-asar/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"private": true,
44
"main": "./app.js",
55
"dependencies": {
6-
"go-ipfs": "^0.7.0",
7-
"ipfs-http-client": "^47.0.1",
6+
"kubo": "^0.32.0",
7+
"kubo-rpc-client": "^5.0.0",
88
"ipfsd-ctl": "file:../.."
99
},
1010
"devDependencies": {

examples/id/id.js

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
/* eslint no-console: 0 */
2-
'use strict'
3-
4-
const { createController } = require('../../src')
2+
const { path } = require('kubo')
3+
const { create } = require('kubo-rpc-client')
4+
/**
5+
* @type {import('../../src')}
6+
*/
7+
const { createNode } = require('../../src')
58

69
async function run () {
7-
const node = await createController({
8-
type: 'go',
9-
ipfsBin: require('go-ipfs').path(),
10-
ipfsHttpModule: require('ipfs-http-client')
10+
const node = await createNode({
11+
type: 'kubo',
12+
rpc: create,
13+
bin: path()
1114
})
1215
console.log('alice')
1316
console.log(await node.api.id())
1417
await node.stop()
15-
16-
const nodeJs = await createController({
17-
type: 'js',
18-
ipfsBin: ipfsModule.path(),
19-
ipfsHttpModule
20-
})
21-
console.log('alice')
22-
console.log(await nodeJs.api.id())
23-
await nodeJs.stop()
24-
25-
const nodeProc = await createController({
26-
type: 'proc',
27-
ipfsModule: require('ipfs'),
28-
ipfsHttpModule: require('ipfs-http-client')
29-
})
30-
console.log('bob')
31-
console.log(await nodeProc.api.id())
32-
await nodeProc.stop()
3318
process.exit()
3419
}
3520

examples/remote-disposable/remote-disposable.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint no-console: 0 */
2-
'use strict'
32

43
// Start a remote disposable node, and get access to the api
54
// print the node id, and stop the temporary daemon

0 commit comments

Comments
 (0)