When should I use Lazy?

You typically use it when you want to instantiate something the first time its actually used. This delays the cost of creating it till if/when it’s needed instead of always incurring the cost. Usually this is preferable when the object may or may not be used and the cost of constructing it is non-trivial.

Read a file one line at a time in node.js?

Since Node.js v0.12 and as of Node.js v4.0.0, there is a stable readline core module. Here’s the easiest way to read lines from a file, without any external modules: const fs = require(‘fs’); const readline = require(‘readline’); async function processLineByLine() { const fileStream = fs.createReadStream(‘input.txt’); const rl = readline.createInterface({ input: fileStream, crlfDelay: Infinity }); // … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)