cvitool 1.0.778 → 1.0.780

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -32,4 +32,12 @@
32
32
 
33
33
  ## [1.0.778] - 2025-10-28
34
34
  ### Fixed
35
- - 修复validate函数string型允许为空情况下去校验regex的问题
35
+ - 修复validate函数string型允许为空情况下去校验regex的问题
36
+
37
+ ## [1.0.779] - 2025-10-29
38
+ ### Fixed
39
+ - 修复checkURLResource函数请求发生ENOTFOUND时抛错问题
40
+
41
+ ## [1.0.780] - 2025-11-11
42
+ ### Fixed
43
+ - 修复getFileType函数未获取到文件类型时报错问题
@@ -363,7 +363,7 @@ function checkURLResource(url, timeout) {
363
363
  res.resBody.destroy();
364
364
  }
365
365
  catch (e) {
366
- if (e.name !== 'statusCodeError') {
366
+ if (e.name !== 'statusCodeError' && !['ENOTFOUND'].includes(e.code)) {
367
367
  throw e;
368
368
  }
369
369
  obj.isEffective = false;
@@ -648,7 +648,7 @@ function getFileType(input_1) {
648
648
  if (getValueType(input) === 'buffer') {
649
649
  stream = stream_1.Readable.from([input]);
650
650
  }
651
- const { ext = '', mime = '' } = yield (0, file_type_1.fromStream)(stream);
651
+ const { ext = '', mime = '' } = (yield (0, file_type_1.fromStream)(stream)) || {};
652
652
  if (!ext || !mime) {
653
653
  return {
654
654
  type: 'unknow',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cvitool",
3
- "version": "1.0.778",
3
+ "version": "1.0.780",
4
4
  "description": "cvitool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/cutil.ts CHANGED
@@ -399,7 +399,7 @@ async function checkURLResource(url: string, timeout?: number) {
399
399
  const res = await hgo.get(url, { resType: 'stream', timeout });
400
400
  (res.resBody as Readable).destroy();
401
401
  } catch (e) {
402
- if (e.name !== 'statusCodeError') {
402
+ if (e.name !== 'statusCodeError' && !['ENOTFOUND'].includes(e.code)) {
403
403
  throw e;
404
404
  }
405
405
  obj.isEffective = false;
@@ -691,7 +691,7 @@ async function getFileType(input: string | Buffer | Readable, reqUrlTimeout = 10
691
691
  if (getValueType(input) === 'buffer') {
692
692
  stream = Readable.from([input as Buffer]);
693
693
  }
694
- const { ext = '', mime = '' } = await fromStream(stream);
694
+ const { ext = '', mime = '' } = (await fromStream(stream)) || {};
695
695
  if (!ext || !mime) {
696
696
  return {
697
697
  type: 'unknow',