{"_id":"mdns-txt","_rev":"201299","name":"mdns-txt","description":"Encode/decode mDNS TXT record RDATA fields","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"watson","email":""}],"time":{"modified":"2021-06-03T12:32:38.000Z","created":"2015-11-08T20:45:11.405Z","2.0.0":"2015-12-23T01:11:01.467Z","1.0.0":"2015-11-08T20:45:11.405Z"},"users":{},"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"repository":{"type":"git","url":"https://github.com/watson/mdns-txt.git"},"versions":{"2.0.0":{"name":"mdns-txt","version":"2.0.0","description":"Encode/decode mDNS TXT record RDATA fields","main":"index.js","dependencies":{"buffer-indexof":"^1.0.0"},"devDependencies":{"tape":"^4.2.2","standard":"^5.3.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/mdns-txt.git"},"keywords":["rfc6763","6763","rfc6762","6762","dns","mdns","multicast","txt","rdata","dns-sd","encode","decode","parse","encoder","decoder","parser","service","discovery"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/mdns-txt/issues"},"homepage":"https://github.com/watson/mdns-txt","coordinates":[55.6877559,12.595542],"gitHead":"f6d606949e5eb342cc736cbd9cf5a716603c76cc","_id":"mdns-txt@2.0.0","_shasum":"59f3cb20c62bef7c1368a5a965e8e82dec003a45","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":""}],"dist":{"shasum":"59f3cb20c62bef7c1368a5a965e8e82dec003a45","size":3954,"noattachment":false,"key":"/mdns-txt/-/mdns-txt-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mdns-txt/download/mdns-txt-2.0.0.tgz"},"directories":{},"publish_time":1450833061467,"_cnpm_publish_time":1450833061467,"deprecated":"WARNING: This project has been renamed to dns-txt. Install using dns-txt instead.","_hasShrinkwrap":false},"1.0.0":{"name":"mdns-txt","version":"1.0.0","description":"Encode/decode mDNS TXT records","main":"index.js","dependencies":{"buffer-indexof":"^1.0.0"},"devDependencies":{"tape":"^4.2.2","standard":"^5.3.1"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"https://github.com/watson/mdns-txt.git"},"keywords":["rfc6763","6763","rfc6762","6762","dns","mdns","multicast","txt","dns-sd","encode","decode","parse","encoder","decoder","parser","service","discovery"],"author":{"name":"Thomas Watson Steen","email":"w@tson.dk","url":"https://twitter.com/wa7son"},"license":"MIT","bugs":{"url":"https://github.com/watson/mdns-txt/issues"},"homepage":"https://github.com/watson/mdns-txt","coordinates":[60.2016461,24.9573858],"gitHead":"73701599f84c1adcdb656cbaa7adbdacdb542a07","_id":"mdns-txt@1.0.0","_shasum":"cb638e750f97507896d27af4d687071edc61a33d","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"watson","email":"w@tson.dk"},"maintainers":[{"name":"watson","email":""}],"dist":{"shasum":"cb638e750f97507896d27af4d687071edc61a33d","size":3544,"noattachment":false,"key":"/mdns-txt/-/mdns-txt-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mdns-txt/download/mdns-txt-1.0.0.tgz"},"directories":{},"publish_time":1447015511405,"_cnpm_publish_time":1447015511405,"_hasShrinkwrap":false}},"readme":"# mdns-txt\n\nEncode or decode the RDATA field in multicast DNS TXT records. For use\nwith DNS-Based Service Discovery. For details see [RFC\n6763](https://tools.ietf.org/html/rfc6763).\n\n[![Build status](https://travis-ci.org/watson/mdns-txt.svg?branch=master)](https://travis-ci.org/watson/mdns-txt)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n[![abstract-encoding](https://img.shields.io/badge/abstract--encoding-compliant-brightgreen.svg?style=flat)](https://github.com/mafintosh/abstract-encoding)\n\n## Installation\n\n```\nnpm install mdns-txt\n```\n\n## Usage\n\n```js\nvar txt = require('mdns-txt')()\n\nvar obj = {\n  foo: 1,\n  bar: 2\n}\n\nvar enc = txt.encode(obj) // <Buffer 05 66 6f 6f 3d 31 05 62 61 72 3d 32>\n\ntxt.decode(enc) // { foo: '1', bar: '2' }\n```\n\n## API\n\nThe encoder and decoder conforms to [RFC 6763](https://tools.ietf.org/html/rfc6763).\n\n### Initialize\n\nThe module exposes a constructor function which can be called with an\noptional options object:\n\n```js\nvar txt = require('mdns-txt')({ binary: true })\n```\n\nThe options are:\n\n- `binary` - If set to `true` all values will be returned as `Buffer`\n  objects. The default behavior is to turn all values into strings. But\n  according to the RFC the values can be any binary data. If you expect\n  binary data, use this option.\n\n#### `txt.encode(obj, [buffer], [offset])`\n\nTakes a key/value object and returns a buffer with the encoded TXT\nrecord. If a buffer is passed as the second argument the object should\nbe encoded into that buffer. Otherwise a new buffer should be allocated\nIf an offset is passed as the third argument the object should be\nencoded at that byte offset. The byte offset defaults to `0`.\n\nThis module does not actively validate the key/value pairs, but keep the\nfollowing in rules in mind:\n\n- To be RFC compliant, each key should conform with the rules as\n  specified in [section\n  6.4](https://tools.ietf.org/html/rfc6763#section-6.4).\n\n- To be RFC compliant, each value should conform with the rules as\n  specified in [section\n  6.5](https://tools.ietf.org/html/rfc6763#section-6.5).\n\nAfter encoding `txt.encode.bytes` is set to the amount of bytes used to\nencode the object.\n\n#### `txt.decode(buffer, [offset], [length])`\n\nTakes a buffer and returns a decoded key/value object. If an offset is\npassed as the second argument the object should be decoded from that\nbyte offset. The byte offset defaults to `0`. Note that all keys will be\nlowercased and all values will be Buffer objects.\n\nAfter decoding `txt.decode.bytes` is set to the amount of bytes used to\ndecode the object.\n\n#### `txt.encodingLength(obj)`\n\nTakes a single key/value object and returns the number of bytes that the given\nobject would require if encoded.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/watson/mdns-txt","bugs":{"url":"https://github.com/watson/mdns-txt/issues"},"license":"MIT"}