Crawler_ECNU
所属分类:数据采集/爬虫
开发工具:JavaScript
文件大小:12832KB
下载次数:0
上传日期:2022-07-22 07:13:57
上 传 者:
sh-1993
说明: 华东师范大学数据学院 web编程期末作业
(East China Normal University Data School Web Programming Final Assignment)
文件列表:
Attempts (0, 2022-07-22)
Attempts\testImport.js (178, 2022-07-22)
Attempts\testIndexPage.js (755, 2022-07-22)
Attempts\testNewsPage.js (1626, 2022-07-22)
Attempts\testSQL.js (474, 2022-07-22)
Attempts\textExport.js (1191, 2022-07-22)
LICENSE (11357, 2022-07-22)
log.md (19800, 2022-07-22)
page.txt (78252, 2022-07-22)
src (0, 2022-07-22)
src\Crawler (0, 2022-07-22)
src\Crawler\CreateTable.js (547, 2022-07-22)
src\Crawler\ScienceNet (0, 2022-07-22)
src\Crawler\ScienceNet\crawl_log.txt (9847696, 2022-07-22)
src\Crawler\ScienceNet\crawler.js (7092, 2022-07-22)
src\Crawler\ScienceNet\error_log.txt (364873, 2022-07-22)
src\Crawler\ScienceNews (0, 2022-07-22)
src\Crawler\ScienceNews\crawl_log.txt (3873998, 2022-07-22)
src\Crawler\ScienceNews\crawler.js (3839, 2022-07-22)
src\Crawler\ScienceNews\error_log.txt (271537, 2022-07-22)
src\Crawler\TestInsert.js (664, 2022-07-22)
src\Crawler\cas.cn (0, 2022-07-22)
src\Crawler\cas.cn\crawl_log.txt (2575790, 2022-07-22)
src\Crawler\cas.cn\crawler.js (4687, 2022-07-22)
src\Crawler\cas.cn\error_log.txt (200527, 2022-07-22)
src\Crawler\sample.js (3088, 2022-07-22)
src\img (0, 2022-07-22)
src\img\a1.png (43334, 2022-07-22)
src\img\a2.png (58980, 2022-07-22)
src\img\a3.png (189858, 2022-07-22)
src\img\a4.png (115985, 2022-07-22)
src\img\c1.png (70098, 2022-07-22)
src\img\c2.png (13105, 2022-07-22)
src\img\c3.png (123884, 2022-07-22)
src\img\cas.png (278869, 2022-07-22)
src\img\chart.png (83435, 2022-07-22)
src\img\css.png (97524, 2022-07-22)
src\img\errlog.png (216146, 2022-07-22)
... ...
# vary
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Manipulate the HTTP Vary header
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install vary
```
## API
```js
var vary = require('vary')
```
### vary(res, field)
Adds the given header `field` to the `Vary` response header of `res`.
This can be a string of a single field, a string of a valid `Vary`
header, or an array of multiple fields.
This will append the header if not already listed, otherwise leaves
it listed in the current location.
```js
// Append "Origin" to the Vary header of the response
vary(res, 'Origin')
```
### vary.append(header, field)
Adds the given header `field` to the `Vary` response header string `header`.
This can be a string of a single field, a string of a valid `Vary` header,
or an array of multiple fields.
This will append the header if not already listed, otherwise leaves
it listed in the current location. The new header string is returned.
```js
// Get header string appending "Origin" to "Accept, User-Agent"
vary.append('Accept, User-Agent', 'Origin')
```
## Examples
### Updating the Vary header when content is based on it
```js
var http = require('http')
var vary = require('vary')
http.createServer(function onRequest (req, res) {
// about to user-agent sniff
vary(res, 'User-Agent')
var ua = req.headers['user-agent'] || ''
var isMobile = /mobi|android|touch|mini/i.test(ua)
// serve site, depending on isMobile
res.setHeader('Content-Type', 'text/html')
res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user')
})
```
## Testing
```sh
$ npm test
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/vary.svg
[npm-url]: https://npmjs.org/package/vary
[node-version-image]: https://img.shields.io/node/v/vary.svg
[node-version-url]: https://nodejs.org/en/download
[travis-image]: https://img.shields.io/travis/jshttp/vary/master.svg
[travis-url]: https://travis-ci.org/jshttp/vary
[coveralls-image]: https://img.shields.io/coveralls/jshttp/vary/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/vary
[downloads-image]: https://img.shields.io/npm/dm/vary.svg
[downloads-url]: https://npmjs.org/package/vary
近期下载者:
相关文件:
收藏者: