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) => {
49
49
} )
50
50
51
51
const stat = await ipfs . files . stat ( testPath )
52
- expect ( stat ) . to . have . property ( 'mtime' , undefined )
52
+ expect ( stat ) . to . not . have . property ( 'mtime' )
53
53
54
54
await ipfs . files . touch ( testPath )
55
55
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ const statters = {
81
81
* @returns {Stat }
82
82
*/
83
83
file : ( file ) => {
84
- return {
84
+ /** @type {Stat } */
85
+ const stat = {
85
86
cid : file . cid ,
86
87
type : 'file' ,
87
88
size : file . unixfs . fileSize ( ) ,
@@ -90,16 +91,22 @@ const statters = {
90
91
local : undefined ,
91
92
sizeLocal : undefined ,
92
93
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
95
99
}
100
+
101
+ return stat
96
102
} ,
97
103
/**
98
104
* @param {import('ipfs-unixfs-exporter').UnixFSDirectory } file
99
105
* @returns {Stat }
100
106
*/
101
107
directory : ( file ) => {
102
- return {
108
+ /** @type {Stat } */
109
+ const stat = {
103
110
cid : file . cid ,
104
111
type : 'directory' ,
105
112
size : 0 ,
@@ -108,9 +115,14 @@ const statters = {
108
115
local : undefined ,
109
116
sizeLocal : undefined ,
110
117
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
113
123
}
124
+
125
+ return stat
114
126
} ,
115
127
/**
116
128
* @param {import('ipfs-unixfs-exporter').ObjectNode } file
You can’t perform that action at this time.
0 commit comments