Narwhals Playing Mahjong
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

higgytools

1.4.5 • Public • Published

higgytools

A collection of node simplifications for web serving and requesting (along with some system commands implemented).

To quickly test the package after installation, type this command from your package directory: node node_modules/higgytools/test.js

requests

Simplified GET and POST requests

GET

get(url, callback)

There's an optional third argument to specify whether you want the response encoding type to be set to binary (for pictures).

POST

post(url, body, callback)

There's an optional fourth argument to specify the response type (default is 'application/json')

serving

Setup simple HTTP server, serve a file, or setup a powerful static file server. There are two final optional arguments to each function that will allow a specification of serving IP and serving port (default are 127.0.0.1 and 8080).

serve

serve(callback)

serve a file

serveFile(filePath)

serve all static files

serveStatic()

The optional first argument is routes to serve as an override to the static response. See the serveRoutes function for more detail on routes. You can specify how many folders deep to start the file search by setting the module's parentDirectories property (default is 0). You can specify an anchor file by setting the module's anchor property.

dynamically serve manually specified routes

serveRoutes(routes)

Routes is an object of {route: function(request, response)} where route is a string.

system commands

If you have these tools installed this can provide just a simple node interface with them.

arp

arp(callback)

Can specify command options (default is none, but command is often used with '-a')

nmap

nmap(ip, callback)

Can specify command options (default is none)

listIPs

listIPs(min, max)

Manually tries to find a hostname for every ip from xxx.xxx.xx.min to xxx.xxx.xx.max. The beginning is found from the router's IP address.

install

npm i higgytools

Downloadsweekly downloads

1,387

version

1.4.5

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability