discloud

1.5.1 • Public • Published

1. Why use discloud ❓  ©X

If you use discord, you can view it directly without using space to store the data,
so it is easy to manage.
Increased storage / retrieval speed.

📜 table of contents 📜

ℹ️ 2. How to use

Sample Code
(async function(){
 
    const cloud = require('discloud');
    const DB = new cloud;
 
    /**
     * How to set when DB is generated
     * -It can also be set using DB.setting()
     */
    const DB = new cloud({
        encode:{//encode settings
            use:true,//encode = on
            key:{
                keyA:"(32 alphanumeric characters)",
                keyB:"(16 alphanumeric characters)"
            }
        },
        token:"Your token is here",
        server:"Your Server ID (This server id's server will be a database)"
    });
 
    /**
     * How to use encode
     */
    DB.encodOn();//Turn on encoding
    DB.setKey("(32 alphanumeric characters)","(16 alphanumeric characters)");//set key
 
    const client = await DB.create("Your token is here",{
        server:"Your Server ID (This server id's server will be a database)",
        //DB.setServer("ID");//You can also set this way
        name:"DataTable's name"
    },
    {}//The value to be set first when creating db
    );
    client.on('error',err=>{
        console.log(err.message);//throw client's error here
    })
    client.on('ready',async ()=>{//client ready
        console.log('ready...');
 
        /**
         * Emphasis is placed on efficiency and safety.
         * The method that directly operates the DB is
         * Only set, get and create are available.
         * Other methods to change settings (such as switching encryption)
         * There is.
         */
        await DB.set("text")//set data in database
        .then(async()=>{
            console.log(await DB.get())
            //text
        }); 
        /**
         * Notify when data set is complete
         */
        client.on('set',data=>{
            data = data[0];//main content (data[1] is this process's key)
            console.log(data.processTime);//Time it took to set
            console.log(data.setData);//Seted data
            console.log(data.info);// = DB.info()
        });
        client.on('get',data=>{
            var info = data[0];
            //main content
            var key = data[1];
            //this process's key
        });
        /**
         * Notify once when nothing is written.
         */
        client.once('writeEnd',async ()=>{
            console.log(await DB.get());
        });
 
        DB.info();
        //You can get Your DB's infomations
    });
})();

3. INFOMATION

This software is released under the MIT License, see LICENSE.txt.

UPDATA ➕

2020:10/10 Significant improvement
2020:10/18 Revised again
2020:11/14 Significant weight reduction
2020:11/17 Fixing a terrible mistake

✅ Operating environment

language

Node.js

Dependencies

discord.js

ℹ️ I recommend having a server dedicated to this database library.

About defects etc ✉️

Contact " Official.neoxbot@gmail.com "

Package Sidebar

Install

npm i discloud

Weekly Downloads

20

Version

1.5.1

License

MIT

Unpacked Size

16.6 kB

Total Files

5

Last publish

Collaborators

  • meiosis