mac-address
v0.3.0
Published
MAC address parsing functions
Downloads
3,490
Readme
mac-address
MAC address parsing functions.
Example
var mac = require('mac-address');
var bufferEqual = require('buffer-equal');
var string = '11:22:33:44:55:66';
var buffer = new Buffer([0x11, 0x22, 0x33, 0x44, 0x55, 0x66]);
// basics
mac.toString(buffer) === string; // true
bufferEqual(mac.toBuffer(string), buffer); // true
var longBuffer = new Buffer(1024);
var offset = 512;
// write directly into an existing buffer
mac.toBuffer(string, longBuffer, offset);
// parse out of the middle of a buffer
mac.toString(longBuffer, offset);