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

@a-2-c-2-anpm/recusandae-dolor-eos

v1.0.0

Published

Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects.

Downloads

16

Maintainers

tranduc345zztranduc345zz

Keywords

chromefastclonemrustableargvmodulecloudfrontarraybufferpositiveiterationloadbalancinglockfiletypescriptcorsespreeweaksetes5elmhotamazonwalkmovephonefast-deep-copyreacttermRFC-6455testingtelephonegraphqltoobjectstoragegatewaydirectoryinspectsettertypeofcloudwatchoffsetbyteincludesidles3parsersetintrinsicgroupBypackagesJSON-SchemaArray.prototype.findLastshamwebrequestavaestreeeventsregexAsyncIteratorUint8ClampedArrayiamkeyscallbackshebangparsejsxexecnodejsbrowserslistfixed-widthcode pointsnegativeconcatMapbindvalueskinesisreplayFloat64ArrayproxyStyleSheetgradients cssES2017openreducereuseFunction.prototype.nametoStringTagless mixinscollection.es6cacheiswatchingmkdirtappropfsthrottleindicatorlint.envqueryminimalfunctionECMAScript 5requirebyteLengthWeakSetwaitpackageformattingcheckcreatewidthcallboundcall-bindpyyamltypedarrayssymbolstatelessglobArray.prototype.includesSymbol.toStringTagefficientremoveentriesfast-deep-clonelinkCSSStyleDeclarationperformanceinArray.prototype.flatECMAScript 2021snslanguagebreakECMAScript 7wordwrapES8datasideponyfillruntimeextensionpromiseendpointloggerfullomittakereadredactparenttrimStartbootstrap cssnested cssexpressdependency managerredux-toolkitstringwrapajvPushES2015ES2021genericskoreancss-in-jsslicenativeES2023getPrototypeOfstdlibhooksemitextraauthenticationwaflook-uphelpersmodulesdeterministicTypeBoxeslint-pluginhasOwnmatchAllansiunicodenegative zerointernal slotencryptionwritablevestmulti-packagelistenersautoscalingpasswordsymbolsapicallzodrangeerrorasciichinesematchmimereadablestreamchannelkeystringifierBigInt64ArrayReactiveXlinewrapswfoptionlibphonenumberenvregular expressiontaskstyleshas-ownnpmdeletecoercibleargumentlazy@@toStringTagworkerwatcherRxJSwgetscheme-validationsymlinksmkdirpebslimitedthroatspinneres8String.prototype.trimframeworkbcryptawsiteratefseventsio-tsStreamsvalidateflagsxhrmake dirprivatees2018mapreduceconsoleformgetOwnPropertyDescriptorObject.valuesReflect.getPrototypeOfmetadataArrayresolvedynamodbarrayfindquerystringmiddlewareec2mapMaprapidagentrm -rfsuperstructgetterES2018promisesdescriptorsimmutableimportInt16ArrayInt32ArraycompareupwarningtoSortedexpressionroutingrdscss lessshimmkdirsqssequenceArray.prototype.flattenString.prototype.matchAllRegExp#flagsstyleguideutilityinstallcommand-lineECMAScript 2019logginggdprobjyupformatgetintrinsicdiridprototypeimmerxtermsorttypedarraycolumndotenvpersistentnamecore-jsbusyRegExp.prototype.flagsloadingmochacloudtrailelasticacheInt8ArrayoncereadablehookformimportexportsearchpropertyvariablesUint8ArraydataViewpackage manageri18nArray.prototype.containslookratelimitaccessorECMAScript 2022formsbrowserlistartcloudsearchES5whichserializationtypesdeep-clonekarmaObject.definePropertysharedarraybufferprivate datatty-0weakmapcss nestingeslintconfigjQueryecmascriptcommanderfind-upshelldeepes2017duplexuninstallcolourtrimLeftesgroupsymlinkspeedemrlessstreamES6postcssUint32ArraytesterES2020streams2rm -frratejsonvalidationfast-clonefastifyvaluecharacterjsonpathlastequalityless.jsextendes2016fromfilter__proto__ECMAScript 2017chromiumes2015concurrencydayjserrorlive

Readme

Follow Redirects

Drop-in replacement for Node's http and https modules that automatically follows redirects.

npm version Build Status Coverage Status npm downloads Sponsor on GitHub

@a-2-c-2-anpm/recusandae-dolor-eos provides request and get methods that behave identically to those found on the native http and https modules, with the exception that they will seamlessly follow redirects.

const { http, https } = require('@a-2-c-2-anpm/recusandae-dolor-eos');

http.get('http://bit.ly/900913', response => {
  response.on('data', chunk => {
    console.log(chunk);
  });
}).on('error', err => {
  console.error(err);
});

You can inspect the final redirected URL through the responseUrl property on the response. If no redirection happened, responseUrl is the original request URL.

const request = https.request({
  host: 'bitly.com',
  path: '/UHfDGO',
}, response => {
  console.log(response.responseUrl);
  // 'http://duckduckgo.com/robots.txt'
});
request.end();

Options

Global options

Global options are set directly on the @a-2-c-2-anpm/recusandae-dolor-eos module:

const followRedirects = require('@a-2-c-2-anpm/recusandae-dolor-eos');
followRedirects.maxRedirects = 10;
followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB

The following global options are supported:

  • maxRedirects (default: 21) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.

  • maxBodyLength (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.

Per-request options

Per-request options are set by passing an options object:

const url = require('url');
const { http, https } = require('@a-2-c-2-anpm/recusandae-dolor-eos');

const options = url.parse('http://bit.ly/900913');
options.maxRedirects = 10;
options.beforeRedirect = (options, response, request) => {
  // Use this to adjust the request options upon redirecting,
  // to inspect the latest response headers,
  // or to cancel the request by throwing an error

  // response.headers = the redirect response headers
  // response.statusCode = the redirect response code (eg. 301, 307, etc.)

  // request.url = the requested URL that resulted in a redirect
  // request.headers = the headers in the request that resulted in a redirect
  // request.method = the method of the request that resulted in a redirect
  if (options.hostname === "example.com") {
    options.auth = "user:password";
  }
};
http.request(options);

In addition to the standard HTTP and HTTPS options, the following per-request options are supported:

  • followRedirects (default: true) – whether redirects should be followed.

  • maxRedirects (default: 21) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.

  • maxBodyLength (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.

  • beforeRedirect (default: undefined) – optionally change the request options on redirects, or abort the request by throwing an error.

  • agents (default: undefined) – sets the agent option per protocol, since HTTP and HTTPS use different agents. Example value: { http: new http.Agent(), https: new https.Agent() }

  • trackRedirects (default: false) – whether to store the redirected response details into the redirects array on the response object.

Advanced usage

By default, @a-2-c-2-anpm/recusandae-dolor-eos will use the Node.js default implementations of http and https. To enable features such as caching and/or intermediate request tracking, you might instead want to wrap @a-2-c-2-anpm/recusandae-dolor-eos around custom protocol implementations:

const { http, https } = require('@a-2-c-2-anpm/recusandae-dolor-eos').wrap({
  http: require('your-custom-http'),
  https: require('your-custom-https'),
});

Such custom protocols only need an implementation of the request method.

Browser Usage

Due to the way the browser works, the http and https browser equivalents perform redirects by default.

By requiring @a-2-c-2-anpm/recusandae-dolor-eos this way:

const http = require('@a-2-c-2-anpm/recusandae-dolor-eos/http');
const https = require('@a-2-c-2-anpm/recusandae-dolor-eos/https');

you can easily tell webpack and friends to replace follow-redirect by the built-in versions:

{
  "@a-2-c-2-anpm/recusandae-dolor-eos/http"  : "http",
  "@a-2-c-2-anpm/recusandae-dolor-eos/https" : "https"
}

Contributing

Pull Requests are always welcome. Please file an issue detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied by tests. You can run the test suite locally with a simple npm test command.

Debug Logging

@a-2-c-2-anpm/recusandae-dolor-eos uses the excellent debug for logging. To turn on logging set the environment variable DEBUG=@a-2-c-2-anpm/recusandae-dolor-eos for debug output from just this module. When running the test suite it is sometimes advantageous to set DEBUG=* to see output from the express server as well.

Authors

License

MIT License