How to use the isEncoding function from safe-buffer

Find comprehensive JavaScript safe-buffer.isEncoding code examples handpicked from public code repositorys.

5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.


var Buffer = require('buffer').Buffer;


var isBufferEncoding = Buffer.isEncoding
  || function(encoding) {
       switch (encoding && 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;
fork icon0
star icon0
watch icon0