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 🙏

© 2025 – Pkg Stats / Ryan Hefner

flora-pac

v0.0.7

Published

A NodeJS port of Flora PAC generator

Downloads

7

Readme

Flora Pac for NodeJS NPM version

A NodeJS port of Flora PAC generator.

Installation / Usage

  1. Install from npm

    $ sudo npm install -g flora-pac
  2. Create your own pac-config.json first (see next chapter)

  3. Run (the default output file is flora.pac)

    $ flora-pac

    or to get some command-line help

    $ flora-pac -h

Configurations

make a config file pac-config.json like this

{
    "proxy"         : "SOCKS5 127.0.0.1:7070; SOCKS 127.0.0.1:7070",
    "normalDomains" : [
        "baidu.com", "v2ex.com"
    ],
    "walledDomains" : [
        "google.com", "youtube.com", 
        "twitter.com", "facebook.com"
    ],
    "fakeIps" : [
        "211.98.70.194", "211.98.70.195"
    ]
}

check src/pac-config.js for more config options available.

INI format is also supported, check this sample for more details

All things done with only one command

$ node <path_to_this_project_root>

Tests

You could run a simple test (assume that flora.pac is already generated)

$ npm install
$ ./pacTest flora.pac twitter.com
$ node test/pacTest flora.pac twitter.com

Or run batch tests

$ npm install
$ node test/test

Speed up the generation time

The CHN IP is requested from apnic

There is approximate 1.6 MB data to download.

You can do it yourself using this command

$ curl http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest -O

If you need to generate multiple files, this will help generating speed up much faster.

Performance

The Performance test code is just copied from clowwindy's gfwlist2pac

An example of generated PAC file is here

Flora Pac uses dnsResolve which makes the execution time very unpredictable.

The test code is modified that return a random IP every time while lookup any host.

Here is the test result:

Testing pac generated by FloraPacNJS
   size: 49324 bytes
  total: 105.797055 ms
average: 1.528859176300578 ns

Testing pac generated by gfwlist2pac
   size: 54800 bytes
  total: 27.962916 ms
average: 0.40408838150289017 ns

Testing pac generated by switchysharp
   size: 506472 bytes
  total: 41940.2284 ms
average: 606.0726647398843 ns

TODO:

  • [X] Add tests
  • [X] Add command-line: --help / --proxy / --internal-proxy / --file / ...
  • ~~Generate minimal pac file, etc: flora.min.pac (meaningless, cancelled)~~
  • [X] Add supports for INI config file rather than general json
  • [ ] Add supports for import domains from GFW whitelist: whitelist.pac (smaller)
  • [ ] Add supports for import domains from fqdns: china_domains.txt (much bigger)
  • [ ] Add supports for import domains from gfwlist.txt (blacklist, much bigger)

See also