npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tor-downloader

v0.1.0

Published

📥 Easily download the Tor expert bundle (tor.exe) with GPG signature check

Downloads

5

Readme

tor-downloader

Node.js CI npm package npm downloads license

📥 Easily download the Tor expert bundle (tor.exe) with GPG signature check

This package lets you easily download the Tor expert bundle (the portable and headless tor.exe binary).

The GPG signature (sig file, .asc) file that comes with the download will be checked using the Tor Browser Developers signing key (EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290). See How can I verify Tor Browser's signature?.

Before starting the download, it will look for Tor in your specified download directory. If it is there, the Tor expert bundle archive GPG file signature will be checked, if valid, the download will be skipped. If the signature is invalid, the files will be deleted and a new clean download will start.

Why

I used to drop a Powershell command to download the portable Tor binary so I wanted a better alternative.
Plus, with this module I can check the GPG key with OpenPGP.js, without requiring GPG to be installed on the target system.

Install

$ yarn add tor-downloader

Usage

import { downloadTor } from 'tor-downloader'

const torPaths = await downloadTor({
  // Default tor-downloader options, all optional
  torBrowserversion: '9.5.3',
  architecture: 'win32',
  torVersion: '0.4.3.6',
  outputPath: './'
})

/* => Tor was downloaded and its GPG signature was checked!
torPaths = {
  downloadURI: string      // Tor expert bundle download URI
  zipPath: string          // Tor expert bundle zip file path
  sigPath: string          // Tor expert bundle zip file `.asc` signature path
  extractedDirPath: string // Path where the Tor expert bundle was extracted to
  binaryPath: string       // `tor.exe` binary path
  neededDownload: boolean  // Was a download required ?
}
*/

Complete usage example

  1. Download Tor
  2. Run Tor without logs (--quiet) using execa
  3. Get the running Tor instance route public IP with node-fetch using the Tor's SOCKS5 proxy server thanks to simple-proxy-agent
  4. Kill Tor
import { downloadTor } from 'tor-downloader'
import fetch from 'node-fetch'
import execa from 'execa'
const ProxyAgent = require('simple-proxy-agent')

const setup = async () => {
  // Download Tor and check its GPG file signature
  const { binaryPath: tor } = await downloadTor()

  // Run Tor and wait 10 seconds to let it connect to the Tor network
  const torRunningInstance = execa(tor, ['--quiet'])
  await new Promise(res => setTimeout(res, 10000))

  // Get public IP with Tor SOCKS5
  const torIP = await fetch('https://api.ipify.org/', {
    agent: new ProxyAgent('socks5://127.0.0.1:9050')
  }).then(res => res.text())
  console.log(`Tor IP: ${torIP}`)

  // Kill Tor
  torRunningInstance.cancel()

  // Get my public IP
  const myIP = await fetch('https://api.ipify.org/').then(res => res.text())
  console.log(`My public IP: ${myIP}`)
}

setup()

// =>
// Tor IP: 46.19.141.84
// My public IP: xxx.xxx.xxx.xxx

License

The MIT license