This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
interface-ipfs-core/src/files
ipfs-core/src/components/files Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ module.exports = (common, options) => {
4949 } )
5050
5151 const stat = await ipfs . files . stat ( testPath )
52- expect ( stat ) . to . have . property ( 'mtime' , undefined )
52+ expect ( stat ) . to . not . have . property ( 'mtime' )
5353
5454 await ipfs . files . touch ( testPath )
5555
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ const statters = {
8181 * @returns {Stat }
8282 */
8383 file : ( file ) => {
84- return {
84+ /** @type {Stat } */
85+ const stat = {
8586 cid : file . cid ,
8687 type : 'file' ,
8788 size : file . unixfs . fileSize ( ) ,
@@ -90,16 +91,22 @@ const statters = {
9091 local : undefined ,
9192 sizeLocal : undefined ,
9293 withLocality : false ,
93- mode : file . unixfs . mode ,
94- mtime : file . unixfs . mtime
94+ mode : file . unixfs . mode
95+ }
96+
97+ if ( file . unixfs . mtime ) {
98+ stat . mtime = file . unixfs . mtime
9599 }
100+
101+ return stat
96102 } ,
97103 /**
98104 * @param {import('ipfs-unixfs-exporter').UnixFSDirectory } file
99105 * @returns {Stat }
100106 */
101107 directory : ( file ) => {
102- return {
108+ /** @type {Stat } */
109+ const stat = {
103110 cid : file . cid ,
104111 type : 'directory' ,
105112 size : 0 ,
@@ -108,9 +115,14 @@ const statters = {
108115 local : undefined ,
109116 sizeLocal : undefined ,
110117 withLocality : false ,
111- mode : file . unixfs . mode ,
112- mtime : file . unixfs . mtime
118+ mode : file . unixfs . mode
119+ }
120+
121+ if ( file . unixfs . mtime ) {
122+ stat . mtime = file . unixfs . mtime
113123 }
124+
125+ return stat
114126 } ,
115127 /**
116128 * @param {import('ipfs-unixfs-exporter').ObjectNode } file
You can’t perform that action at this time.
0 commit comments