Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pfint

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pfint

A module which allows Node.js to interface with PathfinderPC Server (www.pathfinderpc.com)

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

PathfinderPC Server Interface

PathfinderPC Interface for Node.js

This package allows you to interact with PathfinderPC Server.

It keeps an in-memory database (nedb) to keep track of the state - so don't feel bad about querying it lots, it won't hit Pathfinder.

Installation

Do this to get it into your node project:

npm install pfint --save

Usage

Require it, create a new one.

var PFInterface = require('pfint')
var pfint = new PFInterface();
pfint.sync({
	'user' : "Pathfinder_User",
	'password' : "Pathfinder_Password",
	'host' : "localhost",
	'port' : 9500
})

PFInt gives off lots of events and things. It can also be queried.

Methods

There are a coupe of methods you can use

sync(options)

This is the method which starts up the connection.

{
	'user' : "Pathfinder_User",
	'password' : "Pathfinder_Password",
	'host' : "localhost",
	'port' : 9500
}
find(query, cb)

This is basically a passthrough for nedb.find.

cb(err, item)

There are various itemTypes that can be queried for.

  • source
  • destination
  • router
  • protocoltranslator
  • routes

A bit like this:

pfint.find({'itemType' : 'protocoltranslator'}, function(err, pts)
{
    response.end(JSON.stringify(pts))		
})
findOne(query, cb)

The same as the above, except only one result gets returned.

Events

You can connect to events in the normal way:

pfint.on('debug', function (message) {
    console.log(message)
})
debug (message)

Debugging notes come out at various useful points.

connected

Is raised when we are connected to PathfinderPC

memorySlot (slot)

Is raised when a memory slot is updated

route (route)

Is raised when a route is created

error (message)

Raised when an error occurs (no, really?)

gpi (state) DRAFT

Raised when a GPI state changes

Credits

So far, all done by me (Chris)

Like it? Send me some Bitcoins? 1GTw3bJ5UB7g2upzzvXarJ9VZX3gREdpgG 1GTw3bJ5UB7g2upzzvXarJ9VZX3gREdpgG

FAQs

Package last updated on 06 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc