MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / addStats

Function addStats

lib/ldp-container.mjs:115–139  ·  view source on GitHub ↗
(resourceGraph, reqUri, stats, filename)

Source from the content-addressed store, hash-verified

113}
114
115function addStats (resourceGraph, reqUri, stats, filename) {
116 resourceGraph.add(
117 resourceGraph.sym(reqUri),
118 ns.stat('mtime'), // Deprecate?
119 stats.mtime.getTime() / 1000)
120
121 resourceGraph.add(
122 resourceGraph.sym(reqUri),
123 ns.dct('modified'),
124 stats.mtime) // An actual datetime value from a Date object
125
126 resourceGraph.add(
127 resourceGraph.sym(reqUri),
128 ns.stat('size'),
129 stats.size)
130
131 if (!reqUri.endsWith('/') && mime.lookup(filename)) { // Is the file has a well-known type,
132 const type = 'http://www.w3.org/ns/iana/media-types/' + mime.lookup(filename) + '#Resource'
133 resourceGraph.add(
134 resourceGraph.sym(reqUri),
135 ns.rdf('type'), // convert MIME type to RDF
136 resourceGraph.sym(type)
137 )
138 }
139}
140
141function readdir (filename) {
142 debug.handlers('GET -- Reading directory')

Callers 2

addContainerStatsFunction · 0.85
addFileFunction · 0.85

Calls 1

statMethod · 0.80

Tested by

no test coverage detected