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

@copulatrix/wget

v1.0.1

Published

A simple wget-like package to download files. With support for Socks5 proxies.

Downloads

2

Readme

@copulatrix/wget

Purpose

A simple wget-like package to download files. With built in support for Socks5 proxies, allowing to download files from Tor.

Inspired by bearjaws/node-wget

Features

  • [X] Socks Proxy Support

Todo

  • [ ] HTTP/HTTPS Proxy Support
  • [ ] CI Tests
  • [ ] Improve Documentation
  • [ ] Infinite Loop Detection
  • [ ] Custom Request Header Support

Install

npm install @copulatrix/wget

wget(<url>, <destination>, <options>)

var wget = require('@copulatrix/wget');

var download = wget.wget('http://ftp.iinet.net.au/pub/test/5meg.test1', '5meg.test', {
    proxy: 'socks://127.0.0.1:9050/' // optional
});

download.on('error', (error) => {
    console.log(error);
});

download.on('wget', () => {
    console.log('call added to stack');
});

download.on('statuscode', (statuscode) => {
    console.log(statuscode);
});

download.on('filesize', (filesize) => {
    console.log(filesize);
});

download.on('headers', (headers) => {
    console.log(headers);
    // request.abort(); if you just want the headers.
});

download.on('progress', (progress) => {
    console.log(progress);
});

download.on('bytes', (bytes) => {
    console.log(bytes);
});

download.on('chunk', (chunk) => {
    console.log(chunk);
});

download.on('aborted', (aborted) => {
    console.log(aborted);
});

download.on('end', (end) => {
    console.log(end);
});

download.on('complete', (filesize) => {
    console.log(filesize);
});

download.wget();

request(<url>, <options>)

var wget = require('@copulatrix/wget');

var request = wget.request('http://ftp.iinet.net.au/pub/test/5meg.test1', {
    proxy: 'socks://127.0.0.1:9050/' // optional
});

request.on('error', (error) => {
    console.log(error);
});

request.on('request', () => {
    console.log('call added to stack');
});

request.on('statuscode', (statuscode) => {
    console.log(statuscode);
});

request.on('filesize', (filesize) => {
    console.log(filesize);
});

request.on('headers', (headers) => {
    console.log(headers);
    // request.abort(); if you just want the headers.
});

request.on('progress', (progress) => {
    console.log(progress);
});

request.on('bytes', (bytes) => {
    console.log(bytes);
});

request.on('chunk', (chunk) => {
    console.log(chunk);
});

request.on('aborted', (aborted) => {
    console.log(aborted);
});

request.on('end', (end) => {
    console.log(end);
});

request.wget();

Aborting the Connection

Calling .abort() on wget.request or wget.request will abort the connection. This is useful if you just want to receive the headers.

Events

|Event|wget.wget|wget.request|Trigger|Message| |-|-|-|-|-| |wget|✅|❌|When call has been added to the stack.|NULL| |request|❌|✅|When call has been added to the stack.|NULL| |error|✅|✅|When an error has occurred.|Error| |statuscode|✅|✅|When the headers have been received.|Int HTTP Status Code| |filesize|✅|✅|When the headers have been received.|Int Content-Length header value or NULL| |headers|✅|✅|When the headers have been received.|JSON Object HTTP Response Headers| |progress|✅|✅|When a chunk has been received.|Float| |bytes|✅|✅|When a chunk has been received.|Int| |chunk|✅|✅|When a chunk has been received.|Object| |aborted|✅|✅|When the request has been aborted.|NULL| |end|✅|✅|When the request has completed.|Int Response in bytes.| |complete|✅|❌|When an file has finished writing to disk.|Int Saved file's size in bytes.| |event|✅|✅|When an event has been triggered.|[String, Mixed]|