New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

djs-collection-persistent

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

djs-collection-persistent

Collections stored in persistent database.

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Discord.js Collections made Persistent

This repository simply makes Collections ("stolen" from discord.js with permissions) persistent.

Installation

To use Persistent Collections, install them via NPM:

npm install --save djs-collection-persistent

Inside your script, initialize a new PersistentCollection:

const PersistentCollection = require("djs-collection-persistent");

// `name` is the only required value
const myCollection = new PersistentCollection({name: 'myCollection'});

If the collection name already exists, its keys and values loaded in memory. If it does not exist, it is initialized (with no values).

The rest of the regular Collection methods are then used, with no difference in actual usage.

FAQs

Q: What is a "Collection"?

A: Collections are the Javascript Map() data structure with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has an ID, for significantly improved performance and ease-of-use.

Learn more about Collections

Q: What is "Persistent"?

A: With the use of the levelup module, any data added to the Collection is stored not only in temporary memory but also backed up in a local file database. This does not require a server. Saving things in memory enables faster code, but it may take more memory.

Q: How big can a persistent collection be?

A: In its initial implementation, upon loading a PersistentCollection, all key/value pairs are loaded in memory. The size of the memory used is directly proportional to the size of your actual database.

Future versions will have ways to load partial or temporary values, etc.

Keywords

FAQs

Package last updated on 11 Jun 2017

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