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 @@ -7,6 +7,9 @@ const bs58 = require('bs58')
7
7
const series = require ( 'async/series' )
8
8
const hat = require ( 'hat' )
9
9
const { getDescribe, getIt, expect } = require ( '../utils/mocha' )
10
+ const UnixFs = require ( 'ipfs-unixfs' )
11
+ const crypto = require ( 'crypto' )
12
+ const CID = require ( 'cids' )
10
13
11
14
module . exports = ( createCommon , options ) => {
12
15
const describe = getDescribe ( options )
@@ -285,5 +288,23 @@ module.exports = (createCommon, options) => {
285
288
}
286
289
] , done )
287
290
} )
291
+
292
+ it ( 'supplies unadulterated data' , ( ) => {
293
+ // has to be big enough to span several DAGNodes
294
+ const data = crypto . randomBytes ( 1024 * 300 )
295
+
296
+ return ipfs . files . add ( {
297
+ path : '' ,
298
+ content : data
299
+ } )
300
+ . then ( ( result ) => {
301
+ return ipfs . object . get ( result [ 0 ] . hash )
302
+ } )
303
+ . then ( ( node ) => {
304
+ const meta = UnixFs . unmarshal ( node . data )
305
+
306
+ expect ( meta . fileSize ( ) ) . to . equal ( data . length )
307
+ } )
308
+ } )
288
309
} )
289
310
}
Original file line number Diff line number Diff line change 41
41
"dirty-chai" : " ^2.0.1" ,
42
42
"hat" : " 0.0.3" ,
43
43
"ipfs-block" : " ~0.7.1" ,
44
+ "ipfs-unixfs" : " ~0.1.15" ,
44
45
"ipld-dag-cbor" : " ~0.12.1" ,
45
46
"ipld-dag-pb" : " ~0.14.5" ,
46
47
"is-ipfs" : " ~0.3.2" ,
You can’t perform that action at this time.
0 commit comments