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

page-data

v0.0.13

Published

simple page data get client tool

Downloads

37

Readme

page-data

Build Status

Simple page data client tool.

install

npm install page-data

Usage

const page = require('page-data');
const callback = (data, error) => {
    console.log(data);
}

page.status('example.com', callback)
/*
{ request: 'GET: http://example.com/',
  response:
   { statusCode: 200,
     httpVersion: '1.1',
     statusMessage: 'OK',
     headers:
      { 'accept-ranges': 'bytes',
        'cache-control': 'max-age=604800',
        'content-type': 'text/html',
        date: 'Sun, 28 Feb 2016 03:59:55 GMT',
        etag: '"359670651+gzip"',
        expires: 'Sun, 06 Mar 2016 03:59:55 GMT',
        'last-modified': 'Fri, 09 Aug 2013 23:54:35 GMT',
        server: 'ECS (cpm/F9D5)',
        vary: 'Accept-Encoding',
        'x-cache': 'HIT',
        'x-ec-custom-error': '1',
        'content-length': '1270',
        connection: 'close' } } }
*/

This module return Promise object without callback function.

const page = require('page-data');

let promise = page.status('github.com', options);
promise.then(data => {
  console.log(data);
});

API

status(url, [option, callback])

Check whether the page is alive. Simple to only the HTTP GET request.

const page = require('page-data');
page.status('https://github.com', options, callback);

/*
 { request: 'GET: https://github.com/',
   response:
    { statusCode: 200,
      httpVersion: '1.1',
      statusMessage: 'OK',
      headers:
       { server: 'GitHub.com',
         date: 'Sun, 28 Feb 2016 04:04:04 GMT',
         'content-type': 'text/html; charset=utf-8',
         'transfer-encoding': 'chunked',
         connection: 'close',
         status: '200 OK',
         'cache-control': 'no-cache',
         vary: 'X-PJAX, Accept-Encoding',
         'x-ua-compatible': 'IE=Edge,chrome=1',
         'set-cookie': [Object],
         'x-request-id': 'f50cd1559dd7947b46808462684659cd',
         'x-runtime': '0.020611',
         'content-security-policy': 'default-src *; base-uri \'self\'; block-all-mixed-content; child-src ...
         'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
         'public-key-pins': 'max-age=300; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="JbQbUG5JMJUoI6brnx0x3vZF6jilxsapbXGVfjhN8Fg="; includeSubDomains',
         'x-content-type-options': 'nosniff',
         'x-frame-options': 'deny',
         'x-xss-protection': '1; mode=block',
         'x-served-by': '926b734ea1992f8ee1f88ab967a93dac',
         'x-github-request-id': '73A329BC:1143:55012B9:56D271B3' } } }
*/

tls(url, [option, callback])

GET tls information.

const page = require('page-data');
page.tls('github.com', options, callback);

/*
 { subject:
    { businessCategory: 'Private Organization',
      jurisdictionC: 'US',
      jurisdictionST: 'Delaware',
      serialNumber: '5157550',
      street: '548 4th Street',
      postalCode: '94107',
      C: 'US',
      ST: 'California',
      L: 'San Francisco',
      O: 'GitHub, Inc.',
      CN: 'github.com' },
   issuer:
    { C: 'US',
      O: 'DigiCert Inc',
      OU: 'www.digicert.com',
      CN: 'DigiCert SHA2 Extended Validation Server CA' },
   valid_from: 'Apr  8 00:00:00 2014 GMT',
   valid_to: 'Apr 12 12:00:00 2016 GMT',
   infoAccess:
    { 'OCSP - URI': [ 'http://ocsp.digicert.com' ],
      'CA Issuers - URI': [ 'http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt' ] } }
*/

meta(url, [option, callback])

GET page meta data(title, keywords, description, charset)

const page = require('page-data');
page.mata('https://github.com', options, callback);

/*
 { title: 'GitHub · Where software is built',
   charset: 'utf-8',
   keywords: null,
   description: 'GitHub is where people build software. More than 12 million people use GitHub to discover, fork, and contribute to over 31 million projects.' }
;
*/

Cli

page-data-cli

License

MIT © kazu69