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1.2.2/pcap_dump.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/pcap-scribe@1.2.2/pcap_dump.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var util = require(\"util\");\nvar events = require(\"events\");\nvar binding = require(\"./build/Release/pcap_binding\");\n\n\nfunction PcapDumpSession(device_name, filter, buffer_size, outfile, is_monitor, number_of_packets_to_be_read) {\n\n    this.device_name = device_name;\n    this.filter = filter || \"\";\n    this.buffer_size = buffer_size;\n    this.outfile = outfile || \"tmp.pcap\";\n    this.is_monitor = Boolean(is_monitor);\n    this.packets_read = 0;\n    this.number_of_packets_to_be_read = number_of_packets_to_be_read || 1;\n    \n    if (typeof this.buffer_size === \"number\" && !isNaN(this.buffer_size)) {\n        this.buffer_size = Math.round(this.buffer_size);\n    } else {\n        this.buffer_size = 10 * 1024 * 1024; // Default buffer size is 10MB\n    }\n\n    this.device_name = this.device_name || binding.default_device();\n    events.EventEmitter.call(this);\n}\n\nutil.inherits(PcapDumpSession, events.EventEmitter);\n\nexports.lib_version = binding.lib_version();\n\nexports.findalldevs = function () {\n    return binding.findalldevs();\n};\n\n\nPcapDumpSession.prototype.startAsyncCapture = function () {\n\n    this.opened = true;\n    binding.pcap_dump_async(\n        this.device_name,\n        this.filter,\n        this.buffer_size,\n        this.outfile,\n        PcapDumpSession.prototype.on_packet.bind(this),\n        this.is_monitor,\n        this.number_of_packets_to_be_read,\n        PcapDumpSession.prototype.on_pcap_write_complete_async.bind(this)\n    );\n};\n\n\n\n\nPcapDumpSession.prototype.on_pcap_write_complete_async = function (err, packet_count) {\n    \n    if (err) {\n        this.emit(\"pcap_write_error\", err);\n\n    } else {\n        this.emit(\"pcap_write_complete_async\", {\n            \"packets_read\": packet_count,\n            \"fileName\": this.outfile\n        });\n    }\n\n};\n\n\nPcapDumpSession.prototype.on_packet = function (packet) {\n    this.emit(\"packet\", packet);\n\n};\n\n\nexports.PcapDumpSession = PcapDumpSession;\n\n\nexports.createPcapDumpSession = function (device, filter, buffer_size, path, monitor, number_of_packets) {\n    return new PcapDumpSession(device, filter, buffer_size, path, monitor, number_of_packets);\n};"]}