arnaucube
arnaucube/socketioMEANseedPublic Self-hosted repository
socketioMEANseed/server/node_modules/etag/README.md
server/node_modules/etag/README.mdRaw
  1# etag
  2
  3[![NPM Version][npm-image]][npm-url]
  4[![NPM Downloads][downloads-image]][downloads-url]
  5[![Node.js Version][node-version-image]][node-version-url]
  6[![Build Status][travis-image]][travis-url]
  7[![Test Coverage][coveralls-image]][coveralls-url]
  8
  9Create simple ETags
 10
 11## Installation
 12
 13```sh
 14$ npm install etag
 15```
 16
 17## API
 18
 19```js
 20var etag = require('etag')
 21```
 22
 23### etag(entity, [options])
 24
 25Generate a strong ETag for the given entity. This should be the complete
 26body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By
 27default, a strong ETag is generated except for `fs.Stats`, which will
 28generate a weak ETag (this can be overwritten by `options.weak`).
 29
 30```js
 31res.setHeader('ETag', etag(body))
 32```
 33
 34#### Options
 35
 36`etag` accepts these properties in the options object.
 37
 38##### weak
 39
 40Specifies if a "strong" or a "weak" ETag will be generated. The ETag can only
 41really be a strong as the given input.
 42
 43## Testing
 44
 45```sh
 46$ npm test
 47```
 48
 49## Benchmark
 50
 51```bash
 52$ npm run-script bench
 53
 54> etag@1.5.1 bench nodejs-etag
 55> node benchmark/index.js
 56
 57> node benchmark/body0-100b.js
 58
 59  100B body
 60
 61  1 test completed.
 62  2 tests completed.
 63  3 tests completed.
 64  4 tests completed.
 65
 66  buffer - strong x   425,007 ops/sec ±1.47% (184 runs sampled)
 67* buffer - weak   x 1,009,859 ops/sec ±0.18% (197 runs sampled)
 68  string - strong x   442,096 ops/sec ±1.20% (181 runs sampled)
 69  string - weak   x   325,063 ops/sec ±0.31% (192 runs sampled)
 70
 71> node benchmark/body1-1kb.js
 72
 73  1KB body
 74
 75  1 test completed.
 76  2 tests completed.
 77  3 tests completed.
 78  4 tests completed.
 79
 80  buffer - strong x 263,069 ops/sec ±1.60% (190 runs sampled)
 81* buffer - weak   x 295,732 ops/sec ±0.43% (199 runs sampled)
 82  string - strong x 274,822 ops/sec ±1.15% (191 runs sampled)
 83  string - weak   x 169,473 ops/sec ±1.59% (194 runs sampled)
 84
 85> node benchmark/body2-5kb.js
 86
 87  5KB body
 88
 89  1 test completed.
 90  2 tests completed.
 91  3 tests completed.
 92  4 tests completed.
 93
 94  buffer - strong x 104,299 ops/sec ±0.60% (193 runs sampled)
 95* buffer - weak   x 108,126 ops/sec ±0.65% (196 runs sampled)
 96  string - strong x 101,736 ops/sec ±0.78% (194 runs sampled)
 97  string - weak   x 101,266 ops/sec ±0.85% (192 runs sampled)
 98
 99> node benchmark/body3-10kb.js
100
101  10KB body
102
103  1 test completed.
104  2 tests completed.
105  3 tests completed.
106  4 tests completed.
107
108  buffer - strong x 59,007 ops/sec ±0.29% (198 runs sampled)
109* buffer - weak   x 60,968 ops/sec ±0.48% (197 runs sampled)
110  string - strong x 51,873 ops/sec ±1.78% (178 runs sampled)
111  string - weak   x 52,307 ops/sec ±2.63% (193 runs sampled)
112
113> node benchmark/body4-100kb.js
114
115  100KB body
116
117  1 test completed.
118  2 tests completed.
119  3 tests completed.
120  4 tests completed.
121
122  buffer - strong x 6,712 ops/sec ±0.11% (198 runs sampled)
123* buffer - weak   x 6,716 ops/sec ±0.50% (196 runs sampled)
124  string - strong x 6,397 ops/sec ±0.36% (196 runs sampled)
125  string - weak   x 6,635 ops/sec ±0.15% (198 runs sampled)
126```
127
128## License
129
130[MIT](LICENSE)
131
132[npm-image]: https://img.shields.io/npm/v/etag.svg?style=flat
133[npm-url]: https://npmjs.org/package/etag
134[node-version-image]: https://img.shields.io/node/v/etag.svg?style=flat
135[node-version-url]: http://nodejs.org/download/
136[travis-image]: https://img.shields.io/travis/jshttp/etag.svg?style=flat
137[travis-url]: https://travis-ci.org/jshttp/etag
138[coveralls-image]: https://img.shields.io/coveralls/jshttp/etag.svg?style=flat
139[coveralls-url]: https://coveralls.io/r/jshttp/etag?branch=master
140[downloads-image]: https://img.shields.io/npm/dm/etag.svg?style=flat
141[downloads-url]: https://npmjs.org/package/etag