node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

nightlink

Nightlink

Start and control a Tor instance.

Install

$ npm install --save nightlink

Usage

Basic

const nightlink = require('nightlink');
 
const tor = await nightlink.launch({
  SocksPort: 9050
});
 
// Tor has started and connected to the network.
 
await tor.close();

Logs

tor.on('log', {level, msg} => {
  console.log(`[${level}${msg}`);
})

Logs by level

tor.on('notice', console.log);
tor.on('warn', console.log);
tor.on('err', console.error);

Examples

API

nightlink.launch([options])

options

Type: object

Define options to be used.

SocksPort

Type: Number

Define port Tor should start the SOCKS proxy on.

.close()

.on('log', callback)

.on('notice', callback)

.on('warn', callback)

.on('err', callback)

Licence

MIT © Ben Evans