while using node js if I use
buf1= new Buffer(50);
and var buf='';
what is the difference in this initialization.
when should we use buffer
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems like you are rather confused about this, or just worded this question in a strange manner. In my experience, it’s pretty rare that you’ll want to use a buffer over something like a string unless you are dealing with streaming or low-level operations. It seems like the first variable you declared is a buffer, and the second one is a string. If you add a little more context, I’d be able to help you decide whether you need a buffer or a string.
In general, I think the docs on Buffer are what you’re after: http://nodejs.org/api/buffer.html#buffer_buffer