UNPKG

@mt-proto/ncore

Version:

Telegram API JS (MTProto) client library for Node.js and browser

25 lines (18 loc) 549 B
const Configstore = require('configstore'); const baseDebug = require('../../src/utils/common/base-debug'); const debug = baseDebug.extend('storage'); function getLocalStorage(options) { if (!options.path) { throw new Error('Specify the storageOptions.path for storing session'); } const localStorage = new Configstore( '@mtproto/core', {}, { configPath: options.path, } ); debug(`session located in ${localStorage.path}`); return localStorage; } module.exports = getLocalStorage;