Skip to content

Commit cd00bd5

Browse files
committed
暂定名字
1 parent 3fdf42b commit cd00bd5

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"name": "x-crawler",
3+
"name": "x-crawl",
44
"version": "0.0.1",
55
"author": "coderhxl",
66
"description": "XCrawl is a Nodejs crawl library, providing configurations to help you crawl data or files in batches.",

publish/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "x-crawler",
2+
"name": "x-crawl",
33
"version": "0.0.1",
44
"author": "coderhxl",
55
"description": "XCrawl is a Nodejs crawl library, providing configurations to help you crawl data or files in batches.",
66
"license": "MIT",
77
"main": "dist/index.js",
88
"types": "",
9-
"homepage": "https://github.com/coder-hxl/crawler/tree/main/publish",
9+
"homepage": "https://github.com/coder-hxl/x-crawl/tree/main/publish",
1010
"repository": {
1111
"type": "git",
12-
"url": "https://github.com/coder-hxl/crawler"
12+
"url": "https://github.com/coder-hxl/x-crawl"
1313
},
1414
"scripts": {},
1515
"exports": {

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ export default class XCrawl {
4646
function eachRequestResHandle(requestRes: IRequest, currentCount: number) {
4747
const { headers, data } = requestRes
4848

49-
const filename = `${new Date().getTime()}.${headers['content-type']
50-
?.split('/')
51-
.pop()}`
49+
const fileType = headers['content-type']?.split('/').pop()
50+
const filename = `${new Date().getTime()}.${fileType}`
5251
const path = `${fileConfig.storeDir}/${filename}`
5352

5453
fs.createWriteStream(path, 'binary').write(data, (err) => {

0 commit comments

Comments
 (0)