Method description:
Check whether it is a valid encoding parameter and return true or false.
Grammar:
Buffer.isEncoding(encoding)
Receive parameters:
encoding {String} The detected encoding format
Example:
var a = Buffer.isEncoding('base64');
console.log(a);
Source code:
Buffer.isEncoding = function(encoding) {
switch ((encoding '').toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
case 'raw':
return true;
Default:
Return false;
}
};