UNPKG

authweiler

Version:

A full-flegded 0Auth2.0 HTTP proxy server

47 lines (43 loc) 863 B
const leveldown = require('leveldown'); const path = require('path'); /** * * @param config * @returns {{set(*, *), get(*)}} * @constructor */ function LevelStoreImpl(config) { /** * * @type {{location: Location | string | any | number | WorkerLocation | void}} */ const defaults = { /** * Use os module to get the correct ath to the home directory and create a datafile in $HOME/.aw/data */ location: config.location || path.resolve(__dirname, './level/db') }; const _config = Object.assign({}, defaults, config); const level = leveldown(_config.location) return { /** * * @param key */ get(key) {}, /** * * @param key * @param value */ set(key, value) { } } } /** * * @param config */ module.exports = function (config) return LevelStoreImpl(config) }