This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +51
-36
lines changed Expand file tree Collapse file tree 9 files changed +51
-36
lines changed Original file line number Diff line number Diff line change @@ -40,20 +40,21 @@ module.exports = {
40
40
let {
41
41
source,
42
42
dest,
43
- ipfs ,
43
+ getIpfs ,
44
44
parents,
45
45
format,
46
46
hashAlg,
47
47
shardSplitThreshold
48
48
} = argv
49
49
50
- argv . resolve (
51
- ipfs . files . cp ( source , dest , {
50
+ argv . resolve ( ( async ( ) => {
51
+ const ipfs = await getIpfs ( )
52
+ return ipfs . files . cp ( source , dest , {
52
53
parents,
53
54
format,
54
55
hashAlg,
55
56
shardSplitThreshold
56
57
} )
57
- )
58
+ } ) ( ) )
58
59
}
59
60
}
Original file line number Diff line number Diff line change @@ -14,11 +14,12 @@ module.exports = {
14
14
handler ( argv ) {
15
15
let {
16
16
path,
17
- ipfs
17
+ getIpfs
18
18
} = argv
19
19
20
- argv . resolve (
21
- ipfs . files . flush ( path || FILE_SEPARATOR , { } )
22
- )
20
+ argv . resolve ( ( async ( ) => {
21
+ const ipfs = await getIpfs ( )
22
+ return ipfs . files . flush ( path || FILE_SEPARATOR , { } )
23
+ } ) ( ) )
23
24
}
24
25
}
Original file line number Diff line number Diff line change @@ -40,14 +40,15 @@ module.exports = {
40
40
handler ( argv ) {
41
41
let {
42
42
path,
43
- ipfs ,
43
+ getIpfs ,
44
44
long,
45
45
sort,
46
46
cidBase
47
47
} = argv
48
48
49
- argv . resolve (
50
- new Promise ( ( resolve , reject ) => {
49
+ argv . resolve ( ( async ( ) => {
50
+ const ipfs = await getIpfs ( )
51
+ return new Promise ( ( resolve , reject ) => {
51
52
if ( sort ) {
52
53
ipfs . files . ls ( path || FILE_SEPARATOR , {
53
54
long,
@@ -98,6 +99,6 @@ module.exports = {
98
99
} )
99
100
)
100
101
} )
101
- )
102
+ } ) ( ) )
102
103
}
103
104
}
Original file line number Diff line number Diff line change @@ -44,22 +44,24 @@ module.exports = {
44
44
handler ( argv ) {
45
45
let {
46
46
path,
47
- ipfs ,
47
+ getIpfs ,
48
48
parents,
49
49
cidVersion,
50
50
hashAlg,
51
51
flush,
52
52
shardSplitThreshold
53
53
} = argv
54
54
55
- argv . resolve (
56
- ipfs . files . mkdir ( path , {
55
+ argv . resolve ( ( async ( ) => {
56
+ const ipfs = await getIpfs ( )
57
+
58
+ return ipfs . files . mkdir ( path , {
57
59
parents,
58
60
cidVersion,
59
61
hashAlg,
60
62
flush,
61
63
shardSplitThreshold
62
64
} )
63
- )
65
+ } ) ( ) )
64
66
}
65
67
}
Original file line number Diff line number Diff line change @@ -35,18 +35,20 @@ module.exports = {
35
35
let {
36
36
source,
37
37
dest,
38
- ipfs ,
38
+ getIpfs ,
39
39
parents,
40
40
recursive,
41
41
shardSplitThreshold
42
42
} = argv
43
43
44
- argv . resolve (
45
- ipfs . files . mv ( source , dest , {
44
+ argv . resolve ( ( async ( ) => {
45
+ const ipfs = await getIpfs ( )
46
+
47
+ return ipfs . files . mv ( source , dest , {
46
48
parents,
47
49
recursive,
48
50
shardSplitThreshold
49
51
} )
50
- )
52
+ } ) ( ) )
51
53
}
52
54
}
Original file line number Diff line number Diff line change @@ -28,13 +28,15 @@ module.exports = {
28
28
handler ( argv ) {
29
29
let {
30
30
path,
31
- ipfs ,
31
+ getIpfs ,
32
32
offset,
33
33
length
34
34
} = argv
35
35
36
- argv . resolve (
37
- new Promise ( ( resolve , reject ) => {
36
+ argv . resolve ( ( async ( ) => {
37
+ const ipfs = await getIpfs ( )
38
+
39
+ return new Promise ( ( resolve , reject ) => {
38
40
pull (
39
41
ipfs . files . readPullStream ( path , {
40
42
offset,
@@ -52,6 +54,6 @@ module.exports = {
52
54
} )
53
55
)
54
56
} )
55
- )
57
+ } ) ( ) )
56
58
}
57
59
}
Original file line number Diff line number Diff line change @@ -22,14 +22,16 @@ module.exports = {
22
22
handler ( argv ) {
23
23
let {
24
24
path,
25
- ipfs ,
25
+ getIpfs ,
26
26
recursive
27
27
} = argv
28
28
29
- argv . resolve (
30
- ipfs . files . rm ( path , {
29
+ argv . resolve ( ( async ( ) => {
30
+ const ipfs = await getIpfs ( )
31
+
32
+ return ipfs . files . rm ( path , {
31
33
recursive
32
34
} )
33
- )
35
+ } ) ( ) )
34
36
}
35
37
}
Original file line number Diff line number Diff line change @@ -51,15 +51,17 @@ Type: <type>`,
51
51
handler ( argv ) {
52
52
let {
53
53
path,
54
- ipfs ,
54
+ getIpfs ,
55
55
format,
56
56
hash,
57
57
size,
58
58
withLocal
59
59
} = argv
60
60
61
- argv . resolve (
62
- ipfs . files . stat ( path , {
61
+ argv . resolve ( ( async ( ) => {
62
+ const ipfs = await getIpfs ( )
63
+
64
+ return ipfs . files . stat ( path , {
63
65
withLocal
64
66
} )
65
67
. then ( ( stats ) => {
@@ -79,6 +81,6 @@ Type: <type>`,
79
81
. replace ( '<type>' , stats . type )
80
82
)
81
83
} )
82
- )
84
+ } ) ( ) )
83
85
}
84
86
}
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ module.exports = {
89
89
handler ( argv ) {
90
90
let {
91
91
path,
92
- ipfs ,
92
+ getIpfs ,
93
93
offset,
94
94
length,
95
95
create,
@@ -106,8 +106,10 @@ module.exports = {
106
106
shardSplitThreshold
107
107
} = argv
108
108
109
- argv . resolve (
110
- ipfs . files . write ( path , process . stdin , {
109
+ argv . resolve ( ( async ( ) => {
110
+ const ipfs = await getIpfs ( )
111
+
112
+ return ipfs . files . write ( path , process . stdin , {
111
113
offset,
112
114
length,
113
115
create,
@@ -123,6 +125,6 @@ module.exports = {
123
125
flush,
124
126
shardSplitThreshold
125
127
} )
126
- )
128
+ } ) ( ) )
127
129
}
128
130
}
You can’t perform that action at this time.
0 commit comments