Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added cache for pcap_lib_version(3) binding in JavaScript.

  • Loading branch information...
commit e949b900576d5c295e56bb34b2700c72488e26f6 1 parent 6a4637f
@sacko87 authored
Showing with 24 additions and 1 deletion.
  1. +14 −1 index.js
  2. +10 −0 package.json
View
15 index.js
@@ -71,4 +71,17 @@ exports.createOfflineSession = function(file) {
*/
exports.findAllDevices = binding.findAllDevices;
-exports.libraryVersion = binding.libraryVersion;
+
+exports.libraryVersion = function() {
+ // get the library version for the first time
+ libraryVersion = binding.libraryVersion();
+
+ // override the libraryVersion() function
+ // to simply return the text provided by the binding
+ // there is no need to call C++ again for this instance
+ exports.libraryVersion = function() {
+ return libraryVersion;
+ }
+
+ return libraryVersion;
+}
View
10 package.json
@@ -0,0 +1,10 @@
+{
+ "name": "node-pcap",
+ "version": "0.1.0",
+ "description": "raw packet capture",
+ "author": "John T. Saxon <jts@sacko.co.uk>",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/sacko87/node-pcap.git"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.