This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 2 files changed +20
-3
lines changed 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 85
85
"cross-env" : " ^5.2.0" ,
86
86
"dirty-chai" : " ^2.0.1" ,
87
87
"go-ipfs-dep" : " ~0.4.21" ,
88
- "interface-ipfs-core" : " ~0.105 .0" ,
88
+ "interface-ipfs-core" : " ~0.106 .0" ,
89
89
"ipfsd-ctl" : " ~0.43.0" ,
90
90
"nock" : " ^10.0.2" ,
91
91
"stream-equal" : " ^1.1.1"
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const promisify = require ( 'promisify-es6' )
4
+ const streamToValueWithTransformer = require ( '../utils/stream-to-value-with-transformer' )
5
+ const CID = require ( 'cids' )
6
+
7
+ const transform = function ( res , callback ) {
8
+ callback ( null , res . map ( r => ( {
9
+ err : r . Err ? new Error ( r . Err ) : null ,
10
+ cid : ( r . Key || { } ) [ '/' ] ? new CID ( r . Key [ '/' ] ) : null
11
+ } ) ) )
12
+ }
4
13
5
14
module . exports = ( send ) => {
6
15
return promisify ( ( opts , callback ) => {
7
16
if ( typeof ( opts ) === 'function' ) {
8
17
callback = opts
9
18
opts = { }
10
19
}
11
- send ( {
20
+
21
+ const request = {
12
22
path : 'repo/gc' ,
13
23
qs : opts
14
- } , callback )
24
+ }
25
+ send ( request , ( err , result ) => {
26
+ if ( err ) {
27
+ return callback ( err )
28
+ }
29
+
30
+ streamToValueWithTransformer ( result , transform , callback )
31
+ } )
15
32
} )
16
33
}
You can’t perform that action at this time.
0 commit comments