This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 66
66
"joi" : " ^14.3.0" ,
67
67
"joi-browser" : " ^13.4.0" ,
68
68
"mortice" : " ^1.2.1" ,
69
- "multicodec" : " ~0.5.1 " ,
69
+ "multicodec" : " ~0.5.3 " ,
70
70
"multihashes" : " ~0.4.14" ,
71
71
"once" : " ^1.4.0" ,
72
72
"promisify-es6" : " ^1.0.3" ,
Original file line number Diff line number Diff line change @@ -86,5 +86,13 @@ const statters = {
86
86
sizeLocal : undefined ,
87
87
withLocality : false
88
88
}
89
+ } ,
90
+ 'dag-cbor' : ( file ) => {
91
+ return {
92
+ cid : file . cid ,
93
+ local : undefined ,
94
+ sizeLocal : undefined ,
95
+ withLocality : false
96
+ }
89
97
}
90
98
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const expect = chai.expect
7
7
const crypto = require ( 'crypto' )
8
8
const createMfs = require ( './helpers/create-mfs' )
9
9
const createShardedDirectory = require ( './helpers/create-sharded-directory' )
10
+ const mc = require ( 'multicodec' )
10
11
11
12
describe ( 'stat' , ( ) => {
12
13
let mfs
@@ -160,4 +161,15 @@ describe('stat', () => {
160
161
expect ( stats . type ) . to . equal ( 'file' )
161
162
expect ( stats . size ) . to . equal ( 7 )
162
163
} )
164
+
165
+ it ( 'stats a dag-cbor node' , async ( ) => {
166
+ const path = '/cbor.node'
167
+ const node = { }
168
+ const cid = await mfs . ipld . put ( node , mc . getNumber ( 'dag-cbor' ) )
169
+ await mfs . cp ( `/ipfs/${ cid } ` , path )
170
+
171
+ const stats = await mfs . stat ( path )
172
+
173
+ expect ( stats . cid . toString ( ) ) . to . equal ( cid . toString ( ) )
174
+ } )
163
175
} )
You can’t perform that action at this time.
0 commit comments