How to get the class name of an Object in Node JS

Question is very Simple. If you instance, for example, a Buffer you do:

b = new Buffer(0);

then you check the type:

typeof b;

The result is 'Object', but I want to know it is a Buffer.

If you made this in the node console you get it:

>b = new Buffer(1024);
>typeof b
'object'
> b
<Buffer ...>

So, some how the console knows that b is a Buffer.

In your case:

b = new Buffer(1024);
if (b instanceof Buffer) {
  ...

More generally, see this answer.