example of cli usage
This commit is contained in:
parent
23beebf751
commit
6b45a4711f
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
// EXAMPLE:
|
||||
// node pure-parser.js samples/a-0.mdns.bin
|
||||
|
||||
// pass a terminal arg
|
||||
var filename = process.argv[2];
|
||||
if (!filename) {
|
||||
console.error("Usage: node aj-listener.js <type> [count]");
|
||||
console.error("Example: node aj-listener.js _service 0");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
var PromiseA = require('bluebird');
|
||||
var fs = PromiseA.promisifyAll(require('fs'));
|
||||
var pdns = require('./pure-parser');
|
||||
|
||||
fs.readFileAsync(filename, null).then(function (nb) {
|
||||
// nb is a Uint8Array (ArrayBufferView) for nb.buffer
|
||||
// nb.buffer is the actual ArrayBuffer
|
||||
pdns.unpack(nb.buffer);
|
||||
});
|
|
@ -1,23 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
// pass a terminal arg
|
||||
var filename = process.argv[2];
|
||||
if (!filename) {
|
||||
console.error("Usage: node aj-listener.js <type> [count]");
|
||||
console.error("Example: node aj-listener.js _service 0");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
var PromiseA = require('bluebird');
|
||||
var fs = PromiseA.promisifyAll(require('fs'));
|
||||
|
||||
fs.readFileAsync(filename, null).then(function (nb) {
|
||||
// nb is a Uint8Array (ArrayBufferView) for nb.buffer
|
||||
// nb.buffer is the actual ArrayBuffer
|
||||
pdns.unpack(nb.buffer);
|
||||
});
|
||||
|
||||
var pdns = module.exports;
|
||||
|
||||
// Order http://www.zytrax.com/books/dns/ch15/
|
||||
|
|
Loading…
Reference in New Issue