# amp-message High level [AMP](https://github.com/visionmedia/node-amp) `Message` implementation for manipulating, encoding and decoding AMP messages. ## Installation ``` $ npm install amp-message ``` ## Example Encoding a message: ```js var Message = require('amp-message'); var msg = new Message; console.log(msg.toBuffer()); // => msg.push('foo'); msg.push('bar'); msg.push('baz'); console.log(msg.toBuffer()); // => msg.push({ foo: 'bar' }); console.log(msg.toBuffer()); // => msg.push(new Buffer('image data')); console.log(msg.toBuffer()); // => ``` Decoding a message: ```js var Message = require('..'); var msg = new Message; msg.push('foo') msg.push({ hello: 'world' }) msg.push(new Buffer('hello')) var other = new Message(msg.toBuffer()); console.log(other.shift()); console.log(other.shift()); console.log(other.shift()); ``` ## API ### Message Initialize an empty message. ### Message(buffer) Decode the `buffer` AMP message to populate the `Message`. ### Message(args) Initialize a messeage populated with `args`. # License MIT