File tree Expand file tree Collapse file tree 4 files changed +26
-39
lines changed Expand file tree Collapse file tree 4 files changed +26
-39
lines changed Original file line number Diff line number Diff line change 11/* eslint no-console: 0 */ 
2- 'use strict' 
3- 
2+ // @ts -check 
43const  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' ) 
510const  app  =  electron . app 
611const  ipcMain  =  electron . ipcMain 
712const  BrowserWindow  =  electron . BrowserWindow 
813
9- const  {  createController,  createServer }  =  require ( 'ipfsd-ctl' ) 
10- 
1114app . 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' ) 
Original file line number Diff line number Diff line change 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" : {
Original file line number Diff line number Diff line change 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
69async  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
Original file line number Diff line number Diff line change 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 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments