Database Methods: Database Size

Get the current database size.

🪶 This method returns the current size of the database in bytes, if you wish to receive the formatted values, provide the properties below:


format (kB | MB | GB): By default, MerlinDB returns all sizes in bytes.

string (true | false): If you want to format the value to a string, set true.

locale (String): Set the locale to format the string.
1
  • import
  • MerlinDB
  • from
  • "@chrisaxxwell/merlin-db";
    2
  • //Or if you are using 'merlindb.min.js' just call 'new MerlinDB()';
  • 3
    4
  • const
  • merlin =
  • new
  • MerlinDB(
  • )
  • ;
    5merlin
  • .connect(
  • "CATS-DATABASE"
  • )
  • ;
    6
    7merlin
  • .databaseSize(
  • {
  • 8  
  • format:
  • "kb",
    9  
  • string:
  • true
  • ,
    10
  • }
  • )
  • .then(
  • e =>
  • {
  • 11   console
  • .log(
  • e
  • )
  • ;
    12  
  • //44323 bites, or formated "43.28 KB",
  • 13
  • }
  • )
  • ;