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

domain-info-fetcher

v1.2.0

Published

A package to fetch information about a domain including SSL/TLS certificate, server informations, DNS records and HTTP status codes

Downloads

75

Readme

Build GitHub release npm Known Vulnerabilities License GitHub issues

domain-info-fetcher

A simple Node.js package to fetch SSL, server and DNS information of a domain.

Installation

You can install the package using npm:

npm install domain-info-fetcher

Usage

TypeScript

import { fetchDomainInfo } from 'domain-info-fetcher';

async function main() {
  const domainInfo = await fetchDomainInfo('example.com');

  if (domainInfo) {
    console.log('SSL Data:', domainInfo.sslData);
    console.log('Server Data:', domainInfo.serverData);
    console.log('DNS Data:', domainInfo.dnsData);
    console.log('HTTP Status:', domainInfo.httpStatus);
  } else {
    console.error('Error fetching domain information');
  }
}

main();

JavaScript

const { fetchDomainInfo } = require('domain-info-fetcher');

async function main() {
  const domainInfo = await fetchDomainInfo('example.com');
  
  if (domainInfo) {
    console.log('SSL Data:', domainInfo.sslData);
    console.log('Server Data:', domainInfo.serverData);
    console.log('DNS Data:', domainInfo.dnsData);
    console.log('HTTP Status:', domainInfo.httpStatus);
  } else {
    console.error('Error fetching domain information');
  }
}

main();

API

fetchDomainInfo(domain: string): Promise<DomainInfo | undefined>

Fetches the SSL, server and DNS information of the given domain.

| Name | Type | Description | | --- | --- | --- | | domain | string | The domain to fetch the information for. |

Returns a promise that resolves to an object with the following properties:

| Name | Description | | --- | --- | | sslData | The SSL certificate data of the domain. | | serverData | The server software used by the domain. (if available) | | dnsData | The DNS records of the domain. | | httpStatus | The HTTP status code of the domain. |

Returns undefined if an error occurs while fetching the domain information.

DomainInfo

The interface for the object returned by fetchDomainInfo.

interface DomainInfo {
  sslData: {
    subject: { [key: string]: string | string[] };
    issuer: { [key: string]: string | string[] };
    valid: boolean;
    validFrom: number;
    validTo: number;
  }
  serverData: string | undefined;
  dnsData: {
    A: string[];
    CNAME: string | null;
    TXT: string[];
    MX: Array<{ exchange: string; priority: number }>;
    NS: string[];
    SOA: dns.SoaRecord | null;
  } | undefined;
  httpStatus: number | undefined;
}

Contributing to domain-info-fetcher

Thank you for considering contributing to domain-info-fetcher! We welcome contributions from everyone, whether you're an experienced developer or just getting started with open source.

To contribute to this project, please follow these steps:

  1. Fork this repository to your own GitHub account.
  2. Clone your fork to your local machine.
  3. Create a new branch for your changes: git checkout -b my-branch-name.
  4. Make your changes and commit them with a descriptive message.
  5. Push your changes to your fork: git push -u origin my-branch-name.
  6. Open a pull request in this repository and describe the changes you made.

Code style

Please make sure to follow the existing code style as much as possible. We use TypeScript and adhere to the Airbnb JavaScript Style Guide with some minor modifications.

Testing

Please make sure to add appropriate tests for any new code you write, and ensure that all existing tests continue to pass. We use Jest as our testing framework.

Documentation

Please make sure to update the README.md file with any necessary documentation for new features or changes to existing features.

Code of Conduct

This project adheres to the Contributor Covenant, a widely-used standard for community and open source projects. By participating in this project, you agree to abide by its code of conduct.

License

MIT