
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-little-db
Advanced tools
node-little-db是一个基于 Node.js 的第三方库,用于将对象内容同步到文件中。它的原理非常简单,当您更改对象的内容时,它会自动调用fs.writeFileSync()方法将对象内容写入文件。
通过以下命令安装node-little-db:
npm i node-little-db
首先,引入node-little-db库:
const db = require('node-little-db')
然后,获取一个响应式对象:
const user = db.use('user')
现在,您可以对user对象进行操作了。
user.name = 'jack'
user.age = 18
user.hobbies = ['eating', 'sleeping', 'playing Peas']
user.hobbies.push('fish')
user.gender = true
user.address = {
country: 'China',
city: 'Beijing',
}
user.address.city = 'Shanghai'
运行后的文件内容示例
{
"name": "jack",
"age": 18,
"hobbies": [
"eating",
"sleeping",
"playing Peas",
"fish"
],
"address": {
"country": "China",
"city": "Shanghai"
},
"gender": true
}
user.name // 'jack'
user.age // 18
user.hobbies // ['eating', 'sleeping', 'playing Peas']
user.gender // true
user.address // {country: 'China', city: 'Beijing'}
user.address.city // 'Shanghai'
使用指定的文件获取响应式对象,调用该方法后将返回一个代理对象,通过对这个对象进行操作,更改将被同步到文件中。
filename(可选):文件名。如果未提供文件名,则会使用默认文件名 db-${Date.now()}.json。options(可选):选项对象。
options.path:文件存放路径。options.initialData:初始数据,在首次创建文件时使用。options.encoding:文件编码,默认为 utf-8。FAQs
将对象内容同步到文件中的一个Node.js库。
We found that node-little-db demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.