mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-12-02 05:19:17 -06:00
21 lines
379 B
TypeScript
21 lines
379 B
TypeScript
import * as AsyncLRU from 'async-lru'
|
|
import * as jsonld from 'jsonld/'
|
|
import * as jsig from 'jsonld-signatures'
|
|
|
|
const nodeDocumentLoader = jsonld.documentLoaders.node()
|
|
|
|
const lru = new AsyncLRU({
|
|
max: 10,
|
|
load: (key, cb) => {
|
|
nodeDocumentLoader(key, cb)
|
|
}
|
|
})
|
|
|
|
jsonld.documentLoader = (url, cb) => {
|
|
lru.get(url, cb)
|
|
}
|
|
|
|
jsig.use('jsonld', jsonld)
|
|
|
|
export { jsig }
|