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

follow-redirect-url

v2.0.2

Published

A simple command-line utility that lets you follow redirects to see where http URLs end up. Useful for shortened URLs.

Downloads

2,297

Readme

follow-redirect-url

NPM

Node version npm version Build Status Coverage Dependency Status Known npm Vulnerabilities Known Vulnerabilities Downloads Total Downloads Monthly

A simple command-line utility that lets you follow redirects to see where http URLs end up. Useful for shortened URLs.

Follows up to 20 redirects Default.

Also added User-Agent header to requests, some web address won't redirect without browsers information eg: https://fb.me

Table of contents

Installation

Install with npm globally (For CLI):

npm install -g follow-redirect-url

Install for your project:

npm install -save follow-redirect-url

back to top


Usage

CLI:

follow https://bit.ly/2X7gCIT

Module:

The first argument is a url string.

'use strict';

const followRedirect = require('follow-redirect-url');

followRedirect.startFollowing('https://bit.ly/2X7gCIT').then(urls => {
    console.log(urls);
}).catch(error => {
    console.log(error)
})

back to top


Output

CLI Result:

https://bit.ly/2X7gCIT -> 301
http://github.com/sthnaqvi/follow-redirect-url -> 301
https://github.com/sthnaqvi/follow-redirect-url -> 200

Project Result:

[ { url: 'https://bit.ly/2X7gCIT',
    redirect: true,
    status: 301,
    redirectUrl: 'http://github.com/sthnaqvi/follow-redirect-url' },
  { url: 'http://github.com/sthnaqvi/follow-redirect-url',
    redirect: true,
    status: 301,
    redirectUrl: 'https://github.com/sthnaqvi/follow-redirect-url' },
  { url: 'https://github.com/sthnaqvi/follow-redirect-url',
    redirect: false,
    status: 200 } ]

back to top


Options

CLI options:

Under development

Module options:

The second argument is an options object. Options are optional.

  • max_redirect_length - maximum redirection limit. Default: 20
  • request_timeout - request timeout in milliseconds. Default: 10000
  • ignoreSslErrors - ignore SSL certificate errors when following redirects. Default: false
const followRedirect = require('follow-redirect-url');

const options = {
    max_redirect_length: 5,
    request_timeout: 5000,
    ignoreSsslErrors: true
};

followRedirect.startFollowing('https://bit.ly/2X7gCIT', options).then(urls => {
    console.log(urls);
}).catch(error => {
    console.log(error)
})

back to top