test-buffer-bad-overload.js 282 B

123456789101112131415161718
  1. 'use strict';
  2. var Buffer = require('../../').Buffer;
  3. var assert = require('assert');
  4. assert.doesNotThrow(function() {
  5. Buffer.allocUnsafe(10);
  6. });
  7. assert.throws(function() {
  8. Buffer.from(10, 'hex');
  9. });
  10. assert.doesNotThrow(function() {
  11. Buffer.from('deadbeaf', 'hex');
  12. });