0.3.0 • Published 11 years ago

mac-address v0.3.0

Weekly downloads
874
License
-
Repository
github
Last release
11 years ago

mac-address

MAC address parsing functions.

Build Status

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);