This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 8585 "cross-env" : " ^5.2.0" ,
8686 "dirty-chai" : " ^2.0.1" ,
8787 "go-ipfs-dep" : " ~0.4.21" ,
88- "interface-ipfs-core" : " ~0.105 .0" ,
88+ "interface-ipfs-core" : " ~0.106 .0" ,
8989 "ipfsd-ctl" : " ~0.43.0" ,
9090 "nock" : " ^10.0.2" ,
9191 "stream-equal" : " ^1.1.1"
Original file line number Diff line number Diff line change 11'use strict'
22
33const 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+ }
413
514module . exports = ( send ) => {
615 return promisify ( ( opts , callback ) => {
716 if ( typeof ( opts ) === 'function' ) {
817 callback = opts
918 opts = { }
1019 }
11- send ( {
20+
21+ const request = {
1222 path : 'repo/gc' ,
1323 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+ } )
1532 } )
1633}
You can’t perform that action at this time.
0 commit comments