# does-it-fit

> Determine whether an HTTP endpoint's TCP response fits within minimum constraints

Latest version **1.0.3** (published 2016-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install does-it-fit
pnpm add does-it-fit
yarn add does-it-fit
bun add does-it-fit
```

Provides the command `does-it-fit`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-08-20 |
| First published | 2016-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | David Mark Clements |
| Maintainers | davidmarkclements |
| Keywords | performance, TCP, TCP Segment, TCP window, MSS, Ethernet packet, TCP roundtrip |

## Links

- npm: https://www.npmjs.com/package/does-it-fit
- Repository: https://github.com/davidmarkclements/does-it-fit
- Homepage: https://github.com/davidmarkclements/does-it-fit#readme
- Issues: https://github.com/davidmarkclements/does-it-fit/issues
- npm.io page: https://npm.io/package/does-it-fit

## Dependencies (4)

- [split2](https://npm.io/package/split2.md) ^2.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [size-stream](https://npm.io/package/size-stream.md) ^1.0.1
- [array-find-index](https://npm.io/package/array-find-index.md) ^1.0.1

## 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.0.3 (latest) — 2016-08-20
- 1.0.2 — 2016-08-20
- 1.0.1 — 2016-08-20
- 1.0.0 — 2016-08-20

## README

# does-it-fit

Determine whether an HTTP endpoint's TCP response fits within minimum constraints

## Example

```js
const dif = require('does-it-fit')

dif('http://google.com', function (err, answer) {
  if (err) { 
    console.error('oh noes!', err)
    return
  }
  console.log(answer)
})
```

## API

### `require('does-it-fit') => (url, opts, cb(err, result))`

#### `opts`

##### `constraints`
Array of bytes - index of each matches labels
Default: `[536, 1024, 14336, 66560]`

##### `labels` 
Array of labels matching byte windows, 
Default: `['First TCP Segment', 'First Ethernet Packet', 'First TCP Roundtrip', 'First TCP Frame']`

##### `ssl`
Add SSL overhead (default: true)

##### `gzip` 
GZIP the body (default: true)

##### `sslCost`
Estimated amount of bytes for SSL overhead (default: 40)

##### `gzipLevel`
Compression level: 1-9. Defaults to Node's default gzip level


#### `result`

##### `total` 
Total estimated bytes sent along TCP connection for endpoint

##### `fits`
Relevant TCP constraint (First TCP Segment, First Ethernet Packet, First TCP Roundtrip, First 
TCP Frame or No target TCP constraints)

##### `headers` 
Size of headers

##### `body`
Size of body (after gzipping, if enabled)

##### `emulatedSslSize`
Estimated size of SSL overhead (as set by `sslCost`)

##### `emulateGzip` 
Whether GZIP was emulated (disabled with `noGzip`)

##### `gzipLevel`
The compression level applied, only added if `emulateGzip` is `true`

## CLI

```sh
npm install -g does-it-fit
```

```sh
does-it-fit http://google.com
```

```
-h              Help/Usage

-a              Show all values (instead of just total size and what it fits)

--constraints   Array of bytes (as quoted JSON) - index of each matches labels
                Default: [536, 1024, 14336, 66560]

--labels        Array of labels (as quoted JSON) matching byte windows, Default:
                [ 'First TCP Segment', 'First Ethernet Packet', 
                  'First TCP Roundtrip', 'First TCP Frame' ]

--no-ssl        Don't add SSL overhead

--no-gzip       Don't GZIP the body

--ssl-cost      Estimated amount of bytes for SSL overhead (default: 40)

--gzip-level    Compression level: 1-9. Defaults to Node's default gzip level
```

## Test

```sh
npm test
```

## Acknowledgements

* [Yoshua Wuyts](https://github.com/yoshuawuyts)
* Sponsored by [nearForm](http://nearform.com)

## License

MIT

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