# is-http2

> Detect if a server support http/2

Latest version **1.2.0** (published 2017-12-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-http2
pnpm add is-http2
yarn add is-http2
bun add is-http2
```

## Health

**Score 5/100 (F)** — status: abandoned.

Warnings: low downloads; no types; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2017-12-28 |
| First published | 2015-11-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.12.0 |
| Dependencies | 4 |
| Known vulnerabilities | 1 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | stefan judis |
| Maintainers | stefanjudis |
| Keywords | http/2, network, performance |

## Links

- npm: https://www.npmjs.com/package/is-http2
- Repository: https://github.com/stefanjudis/is-http2
- Homepage: https://github.com/stefanjudis/is-http2#readme
- Issues: https://github.com/stefanjudis/is-http2/issues
- npm.io page: https://npm.io/package/is-http2

## Dependencies (4)

- [semver](https://npm.io/package/semver.md) ^5.1.0
- [coveralls](https://npm.io/package/coveralls.md) ^2.11.4
- [find-versions](https://npm.io/package/find-versions.md) ^2.0.0
- [pinkie-promise](https://npm.io/package/pinkie-promise.md) ^2.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2017-12-28
- 1.1.0 — 2016-10-25
- 1.0.4 — 2015-12-06
- 1.0.3 — 2015-11-30
- 1.0.2 — 2015-11-30
- 1.0.1 — 2015-11-30
- 1.0.0 — 2015-11-30

## README

[![Build Status](http://img.shields.io/travis/stefanjudis/is-http2.svg?style=flat)](https://travis-ci.org/stefanjudis/is-http2) [![npm version](http://img.shields.io/npm/v/is-http2.svg?style=flat)](https://www.npmjs.org/package/is-http2) [![npm downloads](http://img.shields.io/npm/dm/is-http2.svg?style=flat)](https://www.npmjs.org/package/is-http2) [![Coverage Status](http://img.shields.io/coveralls/stefanjudis/is-http2.svg?style=flat)](https://coveralls.io/r/stefanjudis/is-http2?branch=master) [![Uses greenkeeper.io](https://img.shields.io/badge/Uses-greenkeeper.io-green.svg)](http://greenkeeper.io/)

# is-http2

Simple module to check if certain servers out there support HTTP/2.

## install

```
$ npm install --save is-http2
```

## Pre-requisites

To make `is-http2` work, you need to have [openssl](http://openssl.org/) in a version greater than 1.0.0 installed and available in your `$path`.

## Basic usage

### isHttp2( url, options )

**Description** : Check if server behind given url supports HTTP/2

**url** : Url to check HTTP/2 support for

#### Options 
* **includeSpdy** : optional: should SPDY be considered HTTP/2
* **openssl** : optional: specify custom openssl command (i.e. '/usr/local/Cellar/openssl/1.0.2k/bin/openssl') 


`isHttp2` returns a Promise which will be resolved with an Object containing `isHttp2` and `supportedProtocols`.

```javascript
const isHttp2 = require( 'is-http2' );

isHttp2( 'twitter.com', { includeSpdy : true } )
  .then( function( result ) {
    if ( result.isHttp2 ) {
      console.log( `${ chalk.green( '✓' ) } HTTP/2 supported by ${ host }` );
    } else {
      console.log( `${ chalk.red( '×' ) } HTTP/2 not supported by ${ host }` );
    }

    if ( result.supportedProtocols ) {
      console.log(
        `Supported protocols: ${ result.supportedProtocols.join( ' ' ) }`
      );
    }
  } )
  .catch( function( error ) {
    console.error( chalk.red( error ) );

    process.exit( 1 );
  } );
```

--------------------------------------------------------

#### I want to thank all these [people](./THANKS.md) for their great work!!!

---
_Source: https://npm.io/package/is-http2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
