node-mkv 简单的键值存储库 项目简介
简单的键值存储库下载安装~ npm install --save[-dev] mkv
# or
~ yarn add [--dev] mkvAPImkv.set(key:string, value:any, readonly:boolean = false)import mkv from "mkv"
mkv.set("hello", "hello world") // string
// -> hello world
mkv.set("options", { a: 1, b: 2, c: 3}) // object
// -> { a: 1, b: 2, c: 3})
// set readonly data.
mkv.set("readonly", 1, true);
// -> 1
mkv.set("readonly", 2)
// throw TypeErrormkv.get(key:string)// in other files.
import mkv from "mkv"
mkv.get("hello")
// -> hello world
mkv.get("options")
// -> {a: 1, b: 2, c: 3}mkv.has(key:string)// in other files.
import mkv from "mkv"
mkv.has("hello")
// -> true
mkv.get("hello2")
// -> falsemkv.delete(key:string)// in other files.
import mkv from "mkv"
mkv.delete("hello")
// -> true
mkv.get("hello")
// -> undefined
# or
~ yarn add [--dev] mkvAPImkv.set(key:string, value:any, readonly:boolean = false)import mkv from "mkv"
mkv.set("hello", "hello world") // string
// -> hello world
mkv.set("options", { a: 1, b: 2, c: 3}) // object
// -> { a: 1, b: 2, c: 3})
// set readonly data.
mkv.set("readonly", 1, true);
// -> 1
mkv.set("readonly", 2)
// throw TypeErrormkv.get(key:string)// in other files.
import mkv from "mkv"
mkv.get("hello")
// -> hello world
mkv.get("options")
// -> {a: 1, b: 2, c: 3}mkv.has(key:string)// in other files.
import mkv from "mkv"
mkv.has("hello")
// -> true
mkv.get("hello2")
// -> falsemkv.delete(key:string)// in other files.
import mkv from "mkv"
mkv.delete("hello")
// -> true
mkv.get("hello")
// -> undefined