Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / etag / README.md
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
9 Create simple ETags
10
11 ## Installation
12
13 ```sh
14 $ npm install etag
15 ```
16
17 ## API
18
19 ```js
20 var etag = require('etag')
21 ```
22
23 ### etag(entity, [options])
24
25 Generate a strong ETag for the given entity. This should be the complete
26 body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By
27 default, a strong ETag is generated except for `fs.Stats`, which will
28 generate a weak ETag (this can be overwritten by `options.weak`).
29
30 ```js
31 res.setHeader('ETag', etag(body))
32 ```
33
34 #### Options
35
36 `etag` accepts these properties in the options object.
37
38 ##### weak
39
40 Specifies if the generated ETag will include the weak validator mark (that
41 is, the leading `W/`). The actual entity tag is the same. The default value
42 is `false`, unless the `entity` is `fs.Stats`, in which case it is `true`.
43
44 ## Testing
45
46 ```sh
47 $ npm test
48 ```
49
50 ## Benchmark
51
52 ```bash
53 $ npm run-script bench
54
55 > etag@1.6.0 bench nodejs-etag
56 > node benchmark/index.js
57
58   http_parser@1.0
59   node@0.10.33
60   v8@3.14.5.9
61   ares@1.9.0-DEV
62   uv@0.10.29
63   zlib@1.2.3
64   modules@11
65   openssl@1.0.1j
66
67 > node benchmark/body0-100b.js
68
69   100B body
70
71   1 test completed.
72   2 tests completed.
73   3 tests completed.
74   4 tests completed.
75
76 * buffer - strong x 289,198 ops/sec ±1.09% (190 runs sampled)
77 * buffer - weak   x 287,838 ops/sec ±0.91% (189 runs sampled)
78 * string - strong x 284,586 ops/sec ±1.05% (192 runs sampled)
79 * string - weak   x 287,439 ops/sec ±0.82% (192 runs sampled)
80
81 > node benchmark/body1-1kb.js
82
83   1KB body
84
85   1 test completed.
86   2 tests completed.
87   3 tests completed.
88   4 tests completed.
89
90 * buffer - strong x 212,423 ops/sec ±0.75% (193 runs sampled)
91 * buffer - weak   x 211,871 ops/sec ±0.74% (194 runs sampled)
92   string - strong x 205,291 ops/sec ±0.86% (194 runs sampled)
93   string - weak   x 208,463 ops/sec ±0.79% (192 runs sampled)
94
95 > node benchmark/body2-5kb.js
96
97   5KB body
98
99   1 test completed.
100   2 tests completed.
101   3 tests completed.
102   4 tests completed.
103
104 * buffer - strong x 92,901 ops/sec ±0.58% (195 runs sampled)
105 * buffer - weak   x 93,045 ops/sec ±0.65% (192 runs sampled)
106   string - strong x 89,621 ops/sec ±0.68% (194 runs sampled)
107   string - weak   x 90,070 ops/sec ±0.70% (196 runs sampled)
108
109 > node benchmark/body3-10kb.js
110
111   10KB body
112
113   1 test completed.
114   2 tests completed.
115   3 tests completed.
116   4 tests completed.
117
118 * buffer - strong x 54,220 ops/sec ±0.85% (192 runs sampled)
119 * buffer - weak   x 54,069 ops/sec ±0.83% (191 runs sampled)
120   string - strong x 53,078 ops/sec ±0.53% (194 runs sampled)
121   string - weak   x 53,849 ops/sec ±0.47% (197 runs sampled)
122
123 > node benchmark/body4-100kb.js
124
125   100KB body
126
127   1 test completed.
128   2 tests completed.
129   3 tests completed.
130   4 tests completed.
131
132 * buffer - strong x 6,673 ops/sec ±0.15% (197 runs sampled)
133 * buffer - weak   x 6,716 ops/sec ±0.12% (198 runs sampled)
134   string - strong x 6,357 ops/sec ±0.14% (197 runs sampled)
135   string - weak   x 6,344 ops/sec ±0.21% (197 runs sampled)
136
137 > node benchmark/stats.js
138
139   stats
140
141   1 test completed.
142   2 tests completed.
143   3 tests completed.
144   4 tests completed.
145
146 * real - strong x 1,671,989 ops/sec ±0.13% (197 runs sampled)
147 * real - weak   x 1,681,297 ops/sec ±0.12% (198 runs sampled)
148   fake - strong x   927,063 ops/sec ±0.14% (198 runs sampled)
149   fake - weak   x   914,461 ops/sec ±0.41% (191 runs sampled)
150 ```
151
152 ## License
153
154 [MIT](LICENSE)
155
156 [npm-image]: https://img.shields.io/npm/v/etag.svg
157 [npm-url]: https://npmjs.org/package/etag
158 [node-version-image]: https://img.shields.io/node/v/etag.svg
159 [node-version-url]: http://nodejs.org/download/
160 [travis-image]: https://img.shields.io/travis/jshttp/etag/master.svg
161 [travis-url]: https://travis-ci.org/jshttp/etag
162 [coveralls-image]: https://img.shields.io/coveralls/jshttp/etag/master.svg
163 [coveralls-url]: https://coveralls.io/r/jshttp/etag?branch=master
164 [downloads-image]: https://img.shields.io/npm/dm/etag.svg
165 [downloads-url]: https://npmjs.org/package/etag