@@ -9,7 +9,10 @@ chai.use(require('dirty-chai'))
99const expect = chai . expect
1010const BlockService = require ( 'ipfs-block-service' )
1111const Ipld = require ( 'ipld' )
12- const pull = require ( 'pull-stream' )
12+ const pull = require ( 'pull-stream/pull' )
13+ const values = require ( 'pull-stream/sources/values' )
14+ const asyncMap = require ( 'pull-stream/throughs/async-map' )
15+ const collect = require ( 'pull-stream/sinks/collect' )
1316const pushable = require ( 'pull-pushable' )
1417const whilst = require ( 'async/whilst' )
1518const setImmediate = require ( 'async/setImmediate' )
@@ -36,14 +39,14 @@ module.exports = (repo) => {
3639 }
3740
3841 pull (
39- pull . values ( [
42+ values ( [
4043 {
4144 path : 'a/b' ,
4245 content : pull . values ( [ Buffer . from ( 'i have the best bytes' ) ] )
4346 }
4447 ] ) ,
4548 importer ( ipld , options ) ,
46- pull . collect ( ( err , nodes ) => {
49+ collect ( ( err , nodes ) => {
4750 try {
4851 expect ( err ) . to . not . exist ( )
4952 expect ( nodes . length ) . to . be . eql ( 2 )
@@ -65,14 +68,14 @@ module.exports = (repo) => {
6568 }
6669
6770 pull (
68- pull . values ( [
71+ values ( [
6972 {
7073 path : 'a/b' ,
71- content : pull . values ( [ Buffer . from ( 'i have the best bytes' ) ] )
74+ content : values ( [ Buffer . from ( 'i have the best bytes' ) ] )
7275 }
7376 ] ) ,
7477 importer ( ipld , options ) ,
75- pull . collect ( ( err , nodes ) => {
78+ collect ( ( err , nodes ) => {
7679 try {
7780 expect ( err ) . to . not . exist ( )
7881 expect ( nodes . length ) . to . be . eql ( 2 )
@@ -92,7 +95,7 @@ module.exports = (repo) => {
9295 it ( 'exporting unsharded hash results in the correct files' , ( done ) => {
9396 pull (
9497 exporter ( nonShardedHash , ipld ) ,
95- pull . collect ( ( err , nodes ) => {
98+ collect ( ( err , nodes ) => {
9699 try {
97100 expect ( err ) . to . not . exist ( )
98101 expect ( nodes . length ) . to . be . eql ( 2 )
@@ -107,7 +110,7 @@ module.exports = (repo) => {
107110
108111 pull (
109112 nodes [ 1 ] . content ,
110- pull . collect ( collected )
113+ collect ( collected )
111114 )
112115 } )
113116 )
@@ -127,7 +130,7 @@ module.exports = (repo) => {
127130 it ( 'exporting sharded hash results in the correct files' , ( done ) => {
128131 pull (
129132 exporter ( shardedHash , ipld ) ,
130- pull . collect ( ( err , nodes ) => {
133+ collect ( ( err , nodes ) => {
131134 try {
132135 expect ( err ) . to . not . exist ( )
133136 expect ( nodes . length ) . to . be . eql ( 2 )
@@ -142,7 +145,7 @@ module.exports = (repo) => {
142145
143146 pull (
144147 nodes [ 1 ] . content ,
145- pull . collect ( collected )
148+ collect ( collected )
146149 )
147150 } )
148151 )
@@ -169,7 +172,7 @@ module.exports = (repo) => {
169172 pull (
170173 push ,
171174 importer ( ipld ) ,
172- pull . collect ( ( err , nodes ) => {
175+ collect ( ( err , nodes ) => {
173176 try {
174177 expect ( err ) . to . not . exist ( )
175178 expect ( nodes . length ) . to . be . eql ( maxDirs + 1 )
@@ -193,7 +196,7 @@ module.exports = (repo) => {
193196 i ++
194197 const pushable = {
195198 path : 'big/' + leftPad ( i . toString ( ) , 4 , '0' ) ,
196- content : pull . values ( [ Buffer . from ( i . toString ( ) ) ] )
199+ content : values ( [ Buffer . from ( i . toString ( ) ) ] )
197200 }
198201 push . push ( pushable )
199202 setImmediate ( callback )
@@ -210,11 +213,11 @@ module.exports = (repo) => {
210213 const entries = { }
211214 pull (
212215 exporter ( rootHash , ipld ) ,
213- pull . asyncMap ( ( node , callback ) => {
216+ asyncMap ( ( node , callback ) => {
214217 if ( node . content ) {
215218 pull (
216219 node . content ,
217- pull . collect ( collected )
220+ collect ( collected )
218221 )
219222 } else {
220223 entries [ node . path ] = node
@@ -227,7 +230,7 @@ module.exports = (repo) => {
227230 callback ( null , node )
228231 }
229232 } ) ,
230- pull . collect ( ( err , nodes ) => {
233+ collect ( ( err , nodes ) => {
231234 expect ( err ) . to . not . exist ( )
232235 const paths = Object . keys ( entries ) . sort ( )
233236 expect ( paths . length ) . to . be . eql ( 2001 )
@@ -265,7 +268,7 @@ module.exports = (repo) => {
265268 pull (
266269 push ,
267270 importer ( ipld ) ,
268- pull . collect ( ( err , nodes ) => {
271+ collect ( ( err , nodes ) => {
269272 expect ( err ) . to . not . exist ( )
270273 const last = nodes [ nodes . length - 1 ]
271274 expect ( last . path ) . to . be . eql ( 'big' )
@@ -289,7 +292,7 @@ module.exports = (repo) => {
289292 }
290293 const pushed = {
291294 path : dir . concat ( leftPad ( i . toString ( ) , 4 , '0' ) ) . join ( '/' ) ,
292- content : pull . values ( [ Buffer . from ( i . toString ( ) ) ] )
295+ content : values ( [ Buffer . from ( i . toString ( ) ) ] )
293296 }
294297 push . push ( pushed )
295298 pending --
@@ -312,11 +315,11 @@ module.exports = (repo) => {
312315 const entries = { }
313316 pull (
314317 exporter ( rootHash , ipld ) ,
315- pull . asyncMap ( ( node , callback ) => {
318+ asyncMap ( ( node , callback ) => {
316319 if ( node . content ) {
317320 pull (
318321 node . content ,
319- pull . collect ( collected )
322+ collect ( collected )
320323 )
321324 } else {
322325 entries [ node . path ] = node
@@ -329,7 +332,7 @@ module.exports = (repo) => {
329332 callback ( null , node )
330333 }
331334 } ) ,
332- pull . collect ( collected )
335+ collect ( collected )
333336 )
334337
335338 function collected ( err , nodes ) {
@@ -371,7 +374,7 @@ module.exports = (repo) => {
371374 const exportHash = new CID ( rootHash ) . toBaseEncodedString ( ) + '/big/big/2000'
372375 pull (
373376 exporter ( exportHash , ipld ) ,
374- pull . collect ( collected )
377+ collect ( collected )
375378 )
376379
377380 function collected ( err , nodes ) {
@@ -382,7 +385,7 @@ module.exports = (repo) => {
382385 ] )
383386 pull (
384387 nodes [ 0 ] . content ,
385- pull . collect ( ( err , content ) => {
388+ collect ( ( err , content ) => {
386389 expect ( err ) . to . not . exist ( )
387390 expect ( content . toString ( ) ) . to . equal ( '2000' )
388391 done ( )
0 commit comments