dfs-adapter 0.0.5 → 1.0.0

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/lib/fastdfs.js CHANGED
@@ -76,7 +76,7 @@ class HttpDfs extends declare_1.Dfs {
76
76
  }
77
77
  async getAccess(path) {
78
78
  if (this.options.access) {
79
- return `${this.options.access}/dfs/get?filename=${path}`;
79
+ return this.options.access + path;
80
80
  }
81
81
  const { domain, group } = this.options;
82
82
  return `${domain}/${group}${path}`;
package/lib/http.js CHANGED
@@ -77,7 +77,7 @@ class HttpDfs extends declare_1.Dfs {
77
77
  }
78
78
  async getAccess(path) {
79
79
  if (this.options.access) {
80
- return `${this.options.access}/dfs/get?filename=${path}`;
80
+ return this.options.access + path;
81
81
  }
82
82
  return `${this.options.url}?filename=${path}`;
83
83
  }
package/lib/minio.js CHANGED
@@ -25,10 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const declare_1 = require("./declare");
27
27
  const minio = __importStar(require("minio"));
28
+ const net = __importStar(require("net"));
28
29
  class MinioDfs extends declare_1.Dfs {
29
30
  client;
30
31
  constructor(options, context) {
31
- super({ accessKey: '', secretKey: '', ...options }, context);
32
+ super({ accessKey: '', secretKey: '', useSSL: false, ...options }, context);
32
33
  this.client = new minio.Client(this.options);
33
34
  }
34
35
  async startup() {
@@ -60,9 +61,13 @@ class MinioDfs extends declare_1.Dfs {
60
61
  }
61
62
  async getAccess(path) {
62
63
  if (this.options.access) {
63
- return `${this.options.access}/dfs/get?filename=${path}`;
64
+ return `${this.options.access}${path}`;
64
65
  }
65
- return `http://${this.options.endPoint}:${this.options.port}/${this.options.bucketName}${path}`;
66
+ let hostname = this.options.endPoint;
67
+ if (net.isIPv6(hostname)) {
68
+ hostname = `[${hostname}]`;
69
+ }
70
+ return `${this.options.useSSL ? 'https' : 'http'}://${hostname}:${this.options.port}/${this.options.bucketName}${path}`;
66
71
  }
67
72
  }
68
73
  exports.default = MinioDfs;
package/lib/native.js CHANGED
@@ -44,7 +44,7 @@ class NativeDfs extends declare_1.Dfs {
44
44
  async upload(path, buffer) {
45
45
  try {
46
46
  this.timeBegin(`upload ${path}`);
47
- let file = `${this.options.storage}${path}`;
47
+ let file = path_1.default.join(this.options.storage, path);
48
48
  let { dir } = path_1.default.parse(file);
49
49
  if (this.logger.isDebugEnabled()) {
50
50
  this.logger.debug(`upload ${path} storage ${file}`);
@@ -68,7 +68,7 @@ class NativeDfs extends declare_1.Dfs {
68
68
  }
69
69
  }
70
70
  async getAccess(path) {
71
- return `${this.options.access}/dfs/get?filename=${path}`;
71
+ return this.options.access + path;
72
72
  }
73
73
  }
74
74
  exports.default = NativeDfs;
package/lib/oss.js CHANGED
@@ -51,7 +51,7 @@ class OssDfs extends declare_1.Dfs {
51
51
  }
52
52
  async getAccess(path) {
53
53
  if (this.options.access) {
54
- return `${this.options.access}/dfs/get?filename=${path}`;
54
+ return this.options.access + path;
55
55
  }
56
56
  return this.client.getObjectUrl(path, this.options.access);
57
57
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dfs-adapter",
3
- "version": "0.0.5",
4
- "description": "oss minio dfs native",
3
+ "version": "1.0.0",
4
+ "description": "oss minio fastdfs native",
5
5
  "main": "./lib/index",
6
6
  "files": [
7
7
  "lib/"
@@ -30,7 +30,7 @@
30
30
  "axios": "^1.6.1",
31
31
  "babel-plugin-transform-decorators-legacy": "^1.3.5",
32
32
  "form-data": "^4.0.0",
33
- "minio": "^7.1.3",
33
+ "minio": "^8.0.0",
34
34
  "vweb-core": "^3.0.14",
35
35
  "vweb-mvc": "^1.2.18"
36
36
  },