Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qiao-config

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qiao-config

json config to local file

  • 4.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-94.81%
Maintainers
1
Weekly downloads
 
Created
Source

qiao-config

npm version npm downloads

nodejs 下基于本地文件的 config 能力

install

安装

npm i qiao-config

use

使用

// cjs
const DB = require('qiao-config');

// mjs
import DB from 'qiao-config';

db

db 实例

// default
const db = DB();

// custom
const db = DB('/custom/path/to/db.json');

api

all

获取所有信息

  • return
    • 类型: object
    • 说明: 所有信息
const all = await db.all();

clear

清空所有信息

await db.clear();

config

获取,设置,删除数据

  • key
    • 类型: string
    • 说明: 只传入 key 时,获取信息
  • value
    • 类型: any
    • 说明:
      • 设置信息时,传入 key 和 value
      • 删除信息时传入 null
  • return
    • 类型: any
    • 说明: 获取信息是返回 value,其他无返回
// get
await db.config(key);

// set
await db.config(key, value);

// del
await db.config(key, null);

Keywords

FAQs

Package last updated on 15 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc