Welcome to my blog !


How to read keystrokes from standard input in nodejs example

September 16, 2021 ·  2 min read

Some times, Nodejs code allows to listen the keyboard events to do some processing related to hardware or script automation. Keyboard has different events keypress keydown Nodejs has a inbuilt object called process which has stdin function to read stream from keyboard network. Nodejs read keystork data and display to user In this example, Create an stdin object using one the below approaches var stdin = process.openStdin(); or var stdin = process....

Nodejs v8 getHeapSpaceStatistics method | Heap space statistics in node

September 15, 2021 ·  3 min read

In this tutorial, You learn v8.getHeapSpaceStatistics() method in v8 module of nodejs with examples getHeapSpaceStatistics method returns statistics about heap sizes based on spaces. v8 is an opensource javascript engine from google chrome and used by nodejs and Mongodb What is a space in v8? Space is an chunk of memory allocated by v8 engine. V8 has a following different spaces for storing and garbage cleaning object in heap memory....

NodeJS v8 getheapstatistics method| How to find heap size?

September 14, 2021 ·  2 min read

In this tutorial, You learn getHeapStatistics method in v8 module of nodejs with examples This includes how to find below things from javascript code How to get the value of max_old_space_size from the code? get max heap size of an nodejs application Retrieve heap memory for string objects total_available_size max-old-space-size V8 is an engine is used internally by Nodejs environment. You can check v8 version and 32 bit or 64 bit for Nodejs...

Sendgrid dynamic email template tutorials with examples

September 13, 2021 ·  3 min read

In this tutorial, We will discuss about sendgrid dynamic template examples for replacing date, currency and iterate object. This tutorial covers an following things How to create a dynamic template in sendgrid dashboard? How to replace dynamic data (HTML) into SendGrid Templates in JavaScript Adding array of json data to templates Iteration loop in sendgrid template conditional check in template format date in sendgrid email template How do create email template in sendgrid?...

Typescript mock interface and async promise example

September 12, 2021 ·  2 min read

In this tutorial, You learned how to test an mock interface in typescript Typescript is an advanced to javascript with strong features like typesafe checking. Jest is an unit testing framework like jasmine from Facebook How to mock an interface in Jest? Let’s declare an interface in typescript with enum being used in interface. role.ts: enum ROLE { ADMIN, SALES, FINANCE } user.ts: export interface User { id: number; name: string; role: ROLE....

Subscribe
You'll get a notification every time a post gets published here.