zonefile-parser
A DNS zonefile parser module with no runtime dependencies, generated from the PEG.js grammar https://github.com/tableflip/zonefile-pegjs
Handles multi-line SOA and TXT records, as well as SRV, MX, CNAME, NS, AAAA, A and friends.
Install
npm install zonefile-parser
Usage
The parser comes in two flavors:
fast.js, the default module exported:
var parser = parser// { origin: null, ttl: null, records:[ { name:'tableflip.io.', ttl: '21599', type:'A', data: '178.62.82.182' } ] }
and small.js in case you're browserifying and want to shave a few bytes:
var parser = parser// { origin: null, ttl: null, records:[ { name:'tableflip.io.', ttl: '21599', type:'A', data: '178.62.82.182' } ] }
Command line tool
Install it globally
npm install -g zonefile-parser
and use it from your shell as zonefile
to convert a zonefile to JSON on stdout:
$ zonefile ../zonefile-pegjs/test/example.zone
A (╯°□°)╯︵TABLEFLIP side project.