cleanup
This commit is contained in:
		
							parent
							
								
									844888caba
								
							
						
					
					
						commit
						4ecb1b679c
					
				| @ -1,13 +1,13 @@ | ||||
| 'use strict'; | ||||
| 
 | ||||
| // EXAMPLE:
 | ||||
| // node pure-parser.js samples/a-0.mdns.bin
 | ||||
| // node bin/dns-parse.js samples/a-0.mdns.bin
 | ||||
| 
 | ||||
| // pass a terminal arg
 | ||||
| var filename = process.argv[2]; | ||||
| if (!filename) { | ||||
|   console.error("Usage: node pure-parser-cli.js <path/to/sample.bin>"); | ||||
|   console.error("Example: node pure-parser-cli.js ./samples/services-0.mdns.bin"); | ||||
|   console.error("Usage: node bin/dns-parse.js <path/to/sample.bin>"); | ||||
|   console.error("Example: node bin/dns-parse.js ./samples/services-0.mdns.bin"); | ||||
|   process.exit(1); | ||||
| } | ||||
| 
 | ||||
| @ -24,10 +24,11 @@ handlers.onError = function (err) { | ||||
|     server.close(); | ||||
| }; | ||||
| handlers.onMessage = function (buffer) { | ||||
|   var path = require('path'); | ||||
|   var name = type + '-' + count + '.mdns.bin'; | ||||
|   count += 1; | ||||
| 
 | ||||
|   fs.writeFileAsync(name, buffer).then(function () { | ||||
|   fs.writeFileAsync(path.join('samples', name), buffer).then(function () { | ||||
|     console.log('wrote ' + buffer.length + ' bytes to ' + name); | ||||
|   }); | ||||
| }; | ||||
| @ -47,4 +48,4 @@ server.on('listening', handlers.onListening); | ||||
| 
 | ||||
| // 53 dns
 | ||||
| // 5353 mdns
 | ||||
| server.bind(5353); | ||||
| server.bind(5353); | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user