This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ const dagPB = require('ipld-dag-pb')
11
11
const DAGNode = dagPB . DAGNode
12
12
const bs58 = require ( 'bs58' )
13
13
const series = require ( 'async/series' )
14
+ const UnixFs = require ( 'ipfs-unixfs' )
15
+ const crypto = require ( 'crypto' )
16
+ const CID = require ( 'cids' )
14
17
15
18
module . exports = ( common ) => {
16
19
describe ( '.object' , function ( ) {
@@ -451,6 +454,24 @@ module.exports = (common) => {
451
454
} )
452
455
} )
453
456
} )
457
+
458
+ it ( 'supplies unadulterated data' , ( ) => {
459
+ // has to be big enough to span several DAGNodes
460
+ const data = crypto . randomBytes ( 1024 * 300 )
461
+
462
+ return ipfs . files . add ( {
463
+ path : '' ,
464
+ content : data
465
+ } )
466
+ . then ( ( result ) => {
467
+ return ipfs . object . get ( result [ 0 ] . hash )
468
+ } )
469
+ . then ( ( node ) => {
470
+ const meta = UnixFs . unmarshal ( node . data )
471
+
472
+ expect ( meta . fileSize ( ) ) . to . equal ( data . length )
473
+ } )
474
+ } )
454
475
} )
455
476
456
477
describe ( '.links' , ( ) => {
Original file line number Diff line number Diff line change 42
42
"dirty-chai" : " ^2.0.1" ,
43
43
"hat" : " 0.0.3" ,
44
44
"ipfs-block" : " ~0.7.1" ,
45
+ "ipfs-unixfs" : " ~0.1.15" ,
45
46
"ipld-dag-cbor" : " ~0.12.0" ,
46
47
"ipld-dag-pb" : " ~0.14.4" ,
47
48
"is-ipfs" : " ~0.3.2" ,
You can’t perform that action at this time.
0 commit comments