Gathering detailed insights and metrics for @picgo/store
Gathering detailed insights and metrics for @picgo/store
Gathering detailed insights and metrics for @picgo/store
Gathering detailed insights and metrics for @picgo/store
npm install @picgo/store
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Commits
2 Watchers
3 Branches
1 Contributors
Updated on Jan 15, 2020
Latest Version
2.1.0
Package Id
@picgo/store@2.1.0
Unpacked Size
193.42 kB
Size
34.10 kB
File Count
36
NPM Version
8.19.4
Node Version
16.20.2
Published on
Sep 10, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
10
27
For PicGo projects to write & read data or configuration in disk.
1import { DBStore } from '@picgo/store' 2 3const db = new DBStore('path/to/your/xxx.db', 'collectionName') 4 5const main = async () => { 6 const result = await db.insert({ 7 imgUrl: 'xxxx.jpg', 8 }) 9 console.log(result) 10 // { 11 // id: 'xxxxx', 12 // imgUrl: 'xxx.jpg', 13 // createdAt: 123123123123, 14 // updatedAt: 123123123123 15 // } 16}
For now, @picgo/store
has two export member: DBStore
& JSONStore
.
new DBStore(dbPath: string, collectionName: string)
1const db = new DBStore('picgo.db', 'uploadImgs')
.get(filter?: IFilter)
Promise<IGetResult<IObject>[]>
To get the whole collection value.
1async () => { 2 const collection = await db.get() 3 console.log(collection) // { total: x, data: [{...}, {...}, ...] } 4}
To get filtered collection: (just like SQL orderBy
, limit
& offset
)
1async () => { 2 const collection = await db.get({ 3 orderBy: 'desc', // ['desc' | 'asc'] -> order with created-time 4 limit: 1, // limit >= 1 5 offset: 0, // offset >= 0 6 }) 7 console.log(collection) // { total: 1, data: [{...}] } 8}
.insert<T>(value: T)
Promise<IResult<T>>
To insert an item to collection.
1async () => { 2 const result = await db.insert({ 3 imgUrl: 'https://xxxx.jpg' 4 }) 5 console.log(result) 6 // { 7 // id: string, 8 // imgUrl: string, 9 // createdAt: number, 10 // updatedAt: number 11 // } 12}
.insertMany<T>(value: T[])
Promise<IResult<T>[]>
To insert multiple items to collection at once .
1async () => { 2 const result = await db.insertMany([ 3 { 4 imgUrl: 'https://xxxx.jpg' 5 }, 6 { 7 imgUrl: 'https://yyyy.jpg' 8 } 9 ]) 10 console.log(result) 11 // [{ 12 // id: string, 13 // imgUrl: string, 14 // createdAt: number, 15 // updatedAt: number 16 // },{ 17 // id: string, 18 // imgUrl: string, 19 // createdAt: number, 20 // updatedAt: number 21 // }] 22}
.updateById(id: string, value: IObject)
Promise<boolean>
To update an item by id. It will return false
if the id does not exist.
1async () => { 2 const result = await db.updateById('test-id', { 3 test: 123 4 }) 5 console.log(result) // true 6}
.getById(id: string)
Promise<IObject | undefined>
To get an item by id.
1async () => { 2 const result = await db.getById('xxx') 3 console.log(result) // undefined 4}
.removeById(id: string)
;Promise<void>
To remove an item by id.
1async () => { 2 const result = await db.removeById('xxx') 3 console.log(result) // undefined 4}
.overwrite<T>(value: T[])
(v2.0.0)Promise<IResult<T>[]>
To overwrite whole collection:
1async () => { 2 const result = await db.overwrite([ 3 { 4 imgUrl: 'https://xxxx.jpg' 5 }, 6 { 7 imgUrl: 'https://yyyy.jpg' 8 } 9 ]) 10 console.log(result) 11 // [{ 12 // id: string, 13 // imgUrl: string, 14 // createdAt: number, 15 // updatedAt: number 16 // },{ 17 // id: string, 18 // imgUrl: string, 19 // createdAt: number, 20 // updatedAt: number 21 // }] 22}
.updateMany(list: IObject[])
(v2.1.0)Promise<{ total: number, success: number }>
To update many items by id:
1async () => {
2 const result = await db.updateMany([
3 {
4 id: 'xxx', // need to have id
5 imgUrl: 'https://xxxx.jpg'
6 },
7 {
8 id: 'yyy',
9 imgUrl: 'https://yyyy.jpg'
10 },
11 {
12 imgUrl: 'https://zzzz.jpg'
13 }
14 ])
15 console.log(result)
16 // { total: 3, success: 2 }
17}
Copyright (c) 2020 Molunerfinn
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
35 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More