Total.js v2.8.0

Wed Sep 06 2017 08:43:15 GMT+0200 (Central European Summer Time), Peter Širka

New release of Total.js v2.8.0

This version brings great new features which makes Total.js framework one of the best and fastest Node.js frameworks in the world. I have performed many performance updates and improvements. Here are the best features in this version:

Rewritten algorithm of packages

I have rewritten packages algorithm from scratch. New algorithm supports streaming data while reading/writing. In other words you can now store files larger than 10 MB (I have tested 100 MB files). New algorithm reduces CPU and memory consuption during the packing/unpacking of packages.

NoSQL embedded database

I can say this database is the best and fastest Node.js embedded database written in pure JavaScript. I have improved a performance around 60% (and reduced CPU and memory consumption) while reading and updating/removing in most cases.

Test:

  • 65 MB database with over 600 000 documents
  • average reading around 1.7 second
  • average updating/removing around 1.9 second

IMPORTANT: database performs multiple reads/updates together when needed.

NoSQL Counter v2

This is one of the coolest features. New NoSQL counter can count min, max and sum values by days/months/years. You can read easily stats for some period or just read a minimal or maximal values by specific identificator. This version has improved performace a lot.

var temporary = 24;
NOSQL('iot').counter.max('livingroom', temporary); // framework creates a "min" value automatically

var temporary = 28;
NOSQL('iot').counter.max('livingroom', temporary);

var temporary = 20;
NOSQL('iot').counter.max('livingroom', temporary);

// After 30 seconds...
// Reading stats:
NOSQL('iot').counter.daily_max('livingroom', console.log);
NOSQL('iot').counter.daily_min('livingroom', console.log);
NOSQL('iot').counter.yearly_max('livingroom', console.log);
NOSQL('iot').counter.monthly_min('livingroom', console.log);
NOSQL('iot').counter.maximum('livingroom', console.log); // 28
NOSQL('iot').counter.minumum('livingroom', console.log); // 20

NoSQL backup

Big feature of this version is backing up of NoSQL embedded databases with all data. The database uses same packaged algorithm like Total.js package system for backing up/restoring. Now you can create a backup with all text and binary files.

Backup:

// Backup database with all files
NOSQL('database').backup(F.path.root('/database.backup'));

Restore:

NOSQL('database').restore(F.path.root('/database.backup'));

NoSQL and HTTP protocol

As I said, one of the best NoSQL embedded databases written in pure JavaScript. New update brings a readonly mode for databases stored on another servers. NoSQL Counter works too.

Try:

NOSQL('https://eshop.totaljs.com/products.txt').find().make(function(builder) {
    builder.where('linker_manufacturer', 'apple');
    builder.fields('name', 'price');
    builder.callback(console.log);
});
NOSQL('https://eshop.totaljs.com/counter.txt').counter.stats(10, 2017, console.log);

Are you kidding me? Not really, it works like a charm.

NoSQL logging

This feature can write a log into the file. It's a great solution for logging when data are manipulated.

  • Method: DatabaseBuilder.log(message, [username])
var db = NOSQL('products');
db.insert(newproduct).log('Created a new product: ' + newproduct.name, controller.user.name);
db.one().where('id', 1).log('Find a product with id "1"');

NoSQL: A quick documents back up

This feature can create a quick backup for documents which are updated, modified or removed.

  • Method: DatabaseBuilder.backup([username])
  • It works only with update(), modify() and remove() method
var db = NOSQL('products');
db.modify({ username: 'Peter Širka').where('username', 'petersirka').backup('Administrator');

New helpers

Create directories according to the path

Nice to know that this method can create directories according to the path:

// It's synchronous
F.path.mkdir('/something/www/directory/total.js/framework/');

Another method for sending mails

  • this method sends a mail message automaticly using the configuration mail-smtp and mail-smtp-options
  • no need to specify smtp as in Mail.send(smtp, [options], messages, [callback]);
var mail = new Mail.message('Subject', 'body');
mail.send2(function(err) {
   console.log('Sent');
})

Updates

View engine: URL

I have improved controller.view() and F.view() method by adding a support for views on another servers.

How it works:

controller.view('https://www.totaljs.com/404.html');

Partial views in an action:

controller.view('https://www.totaljs.com/404.html', null, true)(function(err, html) {
   console.log(html);
});
  • IMPORTANT it won't work in view-engine e.g. @{view('https://....'})

View engine: read a value easily from configuration

This new command can create a cleaner HTML code,

<div>F.config.name: @{'%name'}</div>
<div>F.config['manager-url']: @{'%manager-url'}</div>
<div>F.config.version: @{'%version'}</div>

Persistent cache

I have improved F.cache by adding a new method F.cache.set2() which creates a persistent cache. All persistent items are stored in a file and if the framework is restarted the items are loaded back to F.cache.

F.cache.set2('mycacheitem', 1023, '5 days');

Fixes

This is very important part of the new version.

  • IMPORTANT: fixed long messages in WebSocket now works like a charm
  • fixed JS/CSS/HTML blocks
  • fixed mailmessage.callback() sometimes wasn't called
  • fixed mail-smtp-options user+password can be blank now even if auth is enabled

What's next?

My plan is to update all Total.js products by adding new features from the new Total.js version with new version of jComponent and its UI components.

Do you hear about Total.js for the first time?

Give Total.js platform a try, the invested time will be worth it. Start your business or technology stack with Total.js platform now! Get started.

Thank You to all the sponsors and premium members

Thank you all premium members and sponsors. Your money was used to make all these updates/improvements and much more possible. Thank you again for supporting me so I can do what I love the most. My idea for the near future is to improve documentation, make some more tutorials, courses and maybe a first book.



Tags

Follow us

Latest blogs
Total.js Code Editor v1
Fri Dec 07 2018 22:55:13 GMT+0100 (Central European Standard Time)
New release: Total.js v3.1
Fri Dec 07 2018 11:41:40 GMT+0100 (Central European Standard Time)
New CDN for Flow + Dashboard + Flowboard
Sun Nov 04 2018 09:05:03 GMT+0100 (Central European Standard Time)
OpenPlatform v3
Mon Oct 15 2018 10:11:07 GMT+0200 (Central European Summer Time)
New Single Page Application template
Fri Oct 12 2018 21:25:34 GMT+0200 (Central European Summer Time)

Latest comments
Nice tip
Mauro Junior
Thu Sep 20 2018 21:41:02 GMT+0200 (Central European Summer Time)
Not only for Total.js. You can communicate with different websocket servers.
Peter Širka
Mon Apr 23 2018 20:08:20 GMT+0200 (Central European Summer Time)
Marko: you need to create a buffer with this codepage and write byte-to-byte string. I recommend ...
Peter Širka
Mon Apr 23 2018 20:06:21 GMT+0200 (Central European Summer Time)
Is WEBSOCKETCLIENT only for internal ws connections between totaljs apps?
Stelios Stephanua
Fri Mar 16 2018 06:04:22 GMT+0100 (Central European Standard Time)
Total.js is amazing! ;)
Leonardo Hessel
Tue Dec 19 2017 19:51:15 GMT+0100 (Central European Standard Time)

Pixabay


Read more

Total.js Code Editor v1

Products: Try our real-time collaboration tool for Total Developers. Code Editor offers great features for development.

Fri Dec 07 2018 22:55:13 GMT+0100 (Central European Standard Time)
New release: Total.js v3.1

News: I have released a new version of Total.js with bug fixes and with small improvements.

Fri Dec 07 2018 11:41:40 GMT+0100 (Central European Standard Time)
New CDN for Flow + Dashboard + Flowboard

News: I have changed CDN for Flow + Dashboard + Flowboard components to KeyCDN.

Sun Nov 04 2018 09:05:03 GMT+0100 (Central European Standard Time)
OpenPlatform v3

News: I have published a new version of OpenPlatform. New, better, faster, more secure and more simpler.

Mon Oct 15 2018 10:11:07 GMT+0200 (Central European Summer Time)
New Single Page Application template

News: I have published free, beautiful and simple Total.js + jComponent SPA template under MIT license.

Fri Oct 12 2018 21:25:34 GMT+0200 (Central European Summer Time)
Flow: How to find a specific component?

Tutorials: This tutorial shows you a quick way how to find a specific component in the Flow designer.

Mon Sep 03 2018 20:21:30 GMT+0200 (Central European Summer Time)1