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 +122
-104
lines changed Expand file tree Collapse file tree 9 files changed +122
-104
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ module.exports = {
41
41
hash
42
42
} = argv
43
43
44
- return ipfs . files . cp ( source , dest , {
45
- parents,
46
- format,
47
- hashAlg : hash
48
- } )
44
+ argv . resolve (
45
+ ipfs . files . cp ( source , dest , {
46
+ parents,
47
+ format,
48
+ hashAlg : hash
49
+ } )
50
+ )
49
51
}
50
52
}
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ module.exports = {
17
17
ipfs
18
18
} = argv
19
19
20
- return ipfs . files . flush ( path || FILE_SEPARATOR , { } )
20
+ argv . resolve (
21
+ ipfs . files . flush ( path || FILE_SEPARATOR , { } )
22
+ )
21
23
}
22
24
}
Original file line number Diff line number Diff line change @@ -30,45 +30,47 @@ module.exports = {
30
30
long
31
31
} = argv
32
32
33
- return ipfs . files . ls ( path || FILE_SEPARATOR )
34
- . then ( files => {
35
- if ( long ) {
36
- const table = [ ]
37
- const lengths = { }
38
-
39
- files . forEach ( link => {
40
- const row = {
41
- name : `${ link . name } ` ,
42
- hash : `${ link . hash } ` ,
43
- size : `${ link . size } `
44
- }
45
-
46
- Object . keys ( row ) . forEach ( key => {
47
- const value = row [ key ]
48
-
49
- lengths [ key ] = lengths [ key ] > value . length ? lengths [ key ] : value . length
33
+ argv . resolve (
34
+ ipfs . files . ls ( path || FILE_SEPARATOR )
35
+ . then ( files => {
36
+ if ( long ) {
37
+ const table = [ ]
38
+ const lengths = { }
39
+
40
+ files . forEach ( link => {
41
+ const row = {
42
+ name : `${ link . name } ` ,
43
+ hash : `${ link . hash } ` ,
44
+ size : `${ link . size } `
45
+ }
46
+
47
+ Object . keys ( row ) . forEach ( key => {
48
+ const value = row [ key ]
49
+
50
+ lengths [ key ] = lengths [ key ] > value . length ? lengths [ key ] : value . length
51
+ } )
52
+
53
+ table . push ( row )
50
54
} )
51
55
52
- table . push ( row )
53
- } )
56
+ table . forEach ( row => {
57
+ let line = ''
54
58
55
- table . forEach ( row => {
56
- let line = ''
59
+ Object . keys ( row ) . forEach ( key => {
60
+ const value = row [ key ]
57
61
58
- Object . keys ( row ) . forEach ( key => {
59
- const value = row [ key ]
62
+ line += value . padEnd ( lengths [ key ] )
63
+ line += '\t'
64
+ } )
60
65
61
- line += value . padEnd ( lengths [ key ] )
62
- line += '\t'
66
+ print ( line )
63
67
} )
64
68
65
- print ( line )
66
- } )
69
+ return
70
+ }
67
71
68
- return
69
- }
70
-
71
- files . forEach ( link => print ( link . name ) )
72
- } )
72
+ files . forEach ( link => print ( link . name ) )
73
+ } )
74
+ )
73
75
}
74
76
}
Original file line number Diff line number Diff line change @@ -44,11 +44,13 @@ module.exports = {
44
44
flush
45
45
} = argv
46
46
47
- return ipfs . files . mkdir ( path , {
48
- parents,
49
- cidVersion,
50
- hash,
51
- flush
52
- } )
47
+ argv . resolve (
48
+ ipfs . files . mkdir ( path , {
49
+ parents,
50
+ cidVersion,
51
+ hash,
52
+ flush
53
+ } )
54
+ )
53
55
}
54
56
}
Original file line number Diff line number Diff line change @@ -35,9 +35,11 @@ module.exports = {
35
35
recursive
36
36
} = argv
37
37
38
- return ipfs . files . mv ( source , dest , {
39
- parents,
40
- recursive
41
- } )
38
+ argv . resolve (
39
+ ipfs . files . mv ( source , dest , {
40
+ parents,
41
+ recursive
42
+ } )
43
+ )
42
44
}
43
45
}
Original file line number Diff line number Diff line change @@ -34,28 +34,30 @@ module.exports = {
34
34
length
35
35
} = argv
36
36
37
- return new Promise ( ( resolve , reject ) => {
38
- waterfall ( [
39
- ( cb ) => ipfs . files . readPullStream ( path , {
40
- offset,
41
- length
42
- } , cb ) ,
43
- ( stream , cb ) => {
44
- pull (
45
- stream ,
46
- through ( buffer => {
47
- print ( buffer , false )
48
- } ) ,
49
- collect ( cb )
50
- )
51
- }
52
- ] , ( error ) => {
53
- if ( error ) {
54
- return reject ( error )
55
- }
37
+ argv . resolve (
38
+ new Promise ( ( resolve , reject ) => {
39
+ waterfall ( [
40
+ ( cb ) => ipfs . files . readPullStream ( path , {
41
+ offset,
42
+ length
43
+ } , cb ) ,
44
+ ( stream , cb ) => {
45
+ pull (
46
+ stream ,
47
+ through ( buffer => {
48
+ print ( buffer , false )
49
+ } ) ,
50
+ collect ( cb )
51
+ )
52
+ }
53
+ ] , ( error ) => {
54
+ if ( error ) {
55
+ return reject ( error )
56
+ }
56
57
57
- resolve ( )
58
+ resolve ( )
59
+ } )
58
60
} )
59
- } )
61
+ )
60
62
}
61
63
}
Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ module.exports = {
26
26
recursive
27
27
} = argv
28
28
29
- return ipfs . files . rm ( path , {
30
- recursive
31
- } )
29
+ argv . resolve (
30
+ ipfs . files . rm ( path , {
31
+ recursive
32
+ } )
33
+ )
32
34
}
33
35
}
Original file line number Diff line number Diff line change @@ -54,25 +54,27 @@ Type: <type>`,
54
54
withLocal
55
55
} = argv
56
56
57
- return ipfs . files . stat ( path , {
58
- withLocal
59
- } )
60
- . then ( ( stats ) => {
61
- if ( hash ) {
62
- return print ( stats . hash )
63
- }
57
+ argv . resolve (
58
+ ipfs . files . stat ( path , {
59
+ withLocal
60
+ } )
61
+ . then ( ( stats ) => {
62
+ if ( hash ) {
63
+ return print ( stats . hash )
64
+ }
64
65
65
- if ( size ) {
66
- return print ( stats . size )
67
- }
66
+ if ( size ) {
67
+ return print ( stats . size )
68
+ }
68
69
69
- print ( format
70
- . replace ( '<hash>' , stats . hash )
71
- . replace ( '<size>' , stats . size )
72
- . replace ( '<cumulsize>' , stats . cumulativeSize )
73
- . replace ( '<childs>' , stats . blocks )
74
- . replace ( '<type>' , stats . type )
75
- )
76
- } )
70
+ print ( format
71
+ . replace ( '<hash>' , stats . hash )
72
+ . replace ( '<size>' , stats . size )
73
+ . replace ( '<cumulsize>' , stats . cumulativeSize )
74
+ . replace ( '<childs>' , stats . blocks )
75
+ . replace ( '<type>' , stats . type )
76
+ )
77
+ } )
78
+ )
77
79
}
78
80
}
Original file line number Diff line number Diff line change @@ -85,19 +85,21 @@ module.exports = {
85
85
flush
86
86
} = argv
87
87
88
- return ipfs . files . write ( path , process . stdin , {
89
- offset,
90
- length,
91
- create,
92
- truncate,
93
- rawLeaves,
94
- cidVersion,
95
- hashAlg,
96
- format,
97
- parents,
98
- progress,
99
- strategy,
100
- flush
101
- } )
88
+ argv . resolve (
89
+ ipfs . files . write ( path , process . stdin , {
90
+ offset,
91
+ length,
92
+ create,
93
+ truncate,
94
+ rawLeaves,
95
+ cidVersion,
96
+ hashAlg,
97
+ format,
98
+ parents,
99
+ progress,
100
+ strategy,
101
+ flush
102
+ } )
103
+ )
102
104
}
103
105
}
You can’t perform that action at this time.
0 commit comments