forked from nodeSolidServer/node-solid-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
33 lines (27 loc) · 859 Bytes
/
utils.js
File metadata and controls
33 lines (27 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import debugLib from 'debug'
export const debug = debugLib('solid:server')
export const debugAuth = debugLib('solid:auth')
export const debugACL = debugLib('solid:acl')
export const debugLDP = debugLib('solid:ldp')
export const RDF_MIME_TYPES = [
'text/turtle',
'application/ld+json',
'application/n-triples',
'application/n-quads',
'text/n3',
'application/rdf+xml'
]
export function isRdfMime (contentType) {
if (!contentType) return false
const mime = contentType.split(';')[0].trim().toLowerCase()
return RDF_MIME_TYPES.includes(mime)
}
export function isAuxiliary (path) {
return path.endsWith('.acl') || path.endsWith('.meta')
}
export function getAclPath (path) {
return path.endsWith('/') ? path + '.acl' : path + '.acl'
}
export function getMetaPath (path) {
return path.endsWith('/') ? path + '.meta' : path + '.meta'
}