Determine whether an HTTP endpoint's TCP response fits within minimum constraints
const dif = require('does-it-fit')
dif('http://google.com', function (err, answer) {
if (err) {
console.error('oh noes!', err)
return
}
console.log(answer)
})
require('does-it-fit') => (url, opts, cb(err, result))optsconstraintsArray of bytes - index of each matches labels
Default: [536, 1024, 14336, 66560]
labelsArray of labels matching byte windows,
Default: ['First TCP Segment', 'First Ethernet Packet', 'First TCP Roundtrip', 'First TCP Frame']
sslAdd SSL overhead (default: true)
gzipGZIP the body (default: true)
sslCostEstimated amount of bytes for SSL overhead (default: 40)
gzipLevelCompression level: 1-9. Defaults to Node's default gzip level
resulttotalTotal estimated bytes sent along TCP connection for endpoint
fitsRelevant TCP constraint (First TCP Segment, First Ethernet Packet, First TCP Roundtrip, First TCP Frame or No target TCP constraints)
headersSize of headers
bodySize of body (after gzipping, if enabled)
emulatedSslSizeEstimated size of SSL overhead (as set by sslCost)
emulateGzipWhether GZIP was emulated (disabled with noGzip)
gzipLevelThe compression level applied, only added if emulateGzip is true
npm install -g does-it-fit
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
npm test
MIT