@xen-orchestra/fs 2.0.0 → 3.1.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/dist/_encryptor.js +70 -0
- package/dist/_encryptor.js.map +1 -0
- package/dist/abstract.js +114 -37
- package/dist/abstract.js.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/local.js +73 -23
- package/dist/local.js.map +1 -1
- package/dist/{_path.js → path.js} +11 -2
- package/dist/path.js.map +1 -0
- package/dist/s3.js +9 -1
- package/dist/s3.js.map +1 -1
- package/dist/smb.js +21 -148
- package/dist/smb.js.map +1 -1
- package/package.json +9 -4
- package/dist/_path.js.map +0 -1
- package/dist/smb-mount.js +0 -43
- package/dist/smb-mount.js.map +0 -1
package/dist/smb.js
CHANGED
|
@@ -5,163 +5,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _xoRemoteParser = require("xo-remote-parser");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _mount = _interopRequireDefault(require("./_mount"));
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const wrapError = (error, code) => ({
|
|
15
|
-
__proto__: error,
|
|
16
|
-
cause: error,
|
|
17
|
-
code
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const normalizeError = (error, shouldBeDirectory) => {
|
|
21
|
-
const {
|
|
22
|
-
code
|
|
23
|
-
} = error;
|
|
24
|
-
throw code === 'STATUS_DIRECTORY_NOT_EMPTY' ? wrapError(error, 'ENOTEMPTY') : code === 'STATUS_FILE_IS_A_DIRECTORY' ? wrapError(error, 'EISDIR') : code === 'STATUS_NOT_A_DIRECTORY' ? wrapError(error, 'ENOTDIR') : code === 'STATUS_OBJECT_NAME_NOT_FOUND' || code === 'STATUS_OBJECT_PATH_NOT_FOUND' ? wrapError(error, 'ENOENT') : code === 'STATUS_OBJECT_NAME_COLLISION' ? wrapError(error, 'EEXIST') : code === 'STATUS_NOT_SUPPORTED' || code === 'STATUS_INVALID_PARAMETER' ? wrapError(error, shouldBeDirectory ? 'ENOTDIR' : 'EISDIR') : error;
|
|
25
|
-
};
|
|
12
|
+
var _path = require("./path");
|
|
26
13
|
|
|
27
|
-
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
15
|
|
|
29
|
-
class SmbHandler extends
|
|
16
|
+
class SmbHandler extends _mount.default {
|
|
30
17
|
constructor(remote, opts) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_dirname(file) {
|
|
46
|
-
const parts = file.split('\\');
|
|
47
|
-
parts.pop();
|
|
48
|
-
return parts.join('\\');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_closeFile(file) {
|
|
52
|
-
return this._client.close(file).catch(normalizeError);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_createReadStream(file, options) {
|
|
56
|
-
if (typeof file === 'string') {
|
|
57
|
-
file = this._getFilePath(file);
|
|
58
|
-
} else {
|
|
59
|
-
options = {
|
|
60
|
-
autoClose: false,
|
|
61
|
-
...options,
|
|
62
|
-
fd: file.fd
|
|
63
|
-
};
|
|
64
|
-
file = '';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return this._client.createReadStream(file, options).catch(normalizeError);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_createWriteStream(file, options) {
|
|
71
|
-
if (typeof file === 'string') {
|
|
72
|
-
file = this._getFilePath(file);
|
|
73
|
-
} else {
|
|
74
|
-
options = {
|
|
75
|
-
autoClose: false,
|
|
76
|
-
...options,
|
|
77
|
-
fd: file.fd
|
|
78
|
-
};
|
|
79
|
-
file = '';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return this._client.createWriteStream(file, options).catch(normalizeError);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
_forget() {
|
|
86
|
-
const client = this._client;
|
|
87
|
-
this._client = undefined;
|
|
88
|
-
return client.disconnect();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_getSize(file) {
|
|
92
|
-
return this._client.getSize(this._getFilePath(file)).catch(normalizeError);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
_list(dir) {
|
|
96
|
-
return this._client.readdir(this._getFilePath(dir)).catch(normalizeDirError);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
_mkdir(dir, {
|
|
100
|
-
mode
|
|
101
|
-
}) {
|
|
102
|
-
return this._client.mkdir(this._getFilePath(dir), mode).catch(normalizeDirError);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
_openFile(path, flags) {
|
|
106
|
-
return this._client.open(this._getFilePath(path), flags).catch(normalizeError);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async _read(file, buffer, position) {
|
|
110
|
-
const client = this._client;
|
|
111
|
-
const needsClose = typeof file === 'string';
|
|
112
|
-
file = needsClose ? await client.open(this._getFilePath(file)) : file.fd;
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
return await client.read(file, buffer, 0, buffer.length, position);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
normalizeError(error);
|
|
118
|
-
} finally {
|
|
119
|
-
if (needsClose) {
|
|
120
|
-
await client.close(file);
|
|
18
|
+
const {
|
|
19
|
+
domain = 'WORKGROUP',
|
|
20
|
+
host,
|
|
21
|
+
password,
|
|
22
|
+
path,
|
|
23
|
+
username
|
|
24
|
+
} = (0, _xoRemoteParser.parse)(remote.url);
|
|
25
|
+
super(remote, opts, {
|
|
26
|
+
type: 'cifs',
|
|
27
|
+
device: '//' + host + (0, _path.normalize)(path),
|
|
28
|
+
options: `domain=${domain}`,
|
|
29
|
+
env: {
|
|
30
|
+
USER: username,
|
|
31
|
+
PASSWD: password
|
|
121
32
|
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
_readFile(file, options) {
|
|
126
|
-
return this._client.readFile(this._getFilePath(file), options).catch(normalizeError);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
_rename(oldPath, newPath) {
|
|
130
|
-
return this._client.rename(this._getFilePath(oldPath), this._getFilePath(newPath), {
|
|
131
|
-
replace: true
|
|
132
|
-
}).catch(normalizeError);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_rmdir(dir) {
|
|
136
|
-
return this._client.rmdir(this._getFilePath(dir)).catch(normalizeDirError);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
_sync() {
|
|
140
|
-
const remote = this._remote;
|
|
141
|
-
this._client = new _smb.default({
|
|
142
|
-
share: `\\\\${remote.host}`,
|
|
143
|
-
domain: remote.domain,
|
|
144
|
-
username: remote.username,
|
|
145
|
-
password: remote.password,
|
|
146
|
-
autoCloseTimeout: 0
|
|
147
33
|
});
|
|
148
|
-
return this.list('.');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_truncate(file, len) {
|
|
152
|
-
return this._client.truncate(this._getFilePath(file), len).catch(normalizeError);
|
|
153
34
|
}
|
|
154
35
|
|
|
155
|
-
|
|
156
|
-
return
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
_writeFd(file, buffer, position) {
|
|
160
|
-
return this._client.write(file.fd, buffer, 0, buffer.length, position);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
_writeFile(file, data, options) {
|
|
164
|
-
return this._client.writeFile(this._getFilePath(file), data, options).catch(normalizeError);
|
|
36
|
+
get type() {
|
|
37
|
+
return 'smb';
|
|
165
38
|
}
|
|
166
39
|
|
|
167
40
|
}
|
package/dist/smb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smb.js","names":["wrapError","error","code","__proto__","cause","normalizeError","shouldBeDirectory","normalizeDirError","SmbHandler","RemoteHandlerAbstract","constructor","remote","opts","_client","undefined","prefix","_remote","path","_prefix","type","_getFilePath","file","slice","replace","_dirname","parts","split","pop","join","_closeFile","close","catch","_createReadStream","options","autoClose","fd","createReadStream","_createWriteStream","createWriteStream","_forget","client","disconnect","_getSize","getSize","_list","dir","readdir","_mkdir","mode","mkdir","_openFile","flags","open","_read","buffer","position","needsClose","read","length","_readFile","readFile","_rename","oldPath","newPath","rename","_rmdir","rmdir","_sync","Smb2","share","host","domain","username","password","autoCloseTimeout","list","_truncate","len","truncate","_unlink","unlink","_writeFd","write","_writeFile","data","writeFile"],"sources":["../src/smb.js"],"sourcesContent":["import Smb2 from '@marsaud/smb2'\n\nimport RemoteHandlerAbstract from './abstract'\n\n// Normalize the error code for file not found.\nconst wrapError = (error, code) => ({\n __proto__: error,\n cause: error,\n code,\n})\nconst normalizeError = (error, shouldBeDirectory) => {\n const { code } = error\n\n throw code === 'STATUS_DIRECTORY_NOT_EMPTY'\n ? wrapError(error, 'ENOTEMPTY')\n : code === 'STATUS_FILE_IS_A_DIRECTORY'\n ? wrapError(error, 'EISDIR')\n : code === 'STATUS_NOT_A_DIRECTORY'\n ? wrapError(error, 'ENOTDIR')\n : code === 'STATUS_OBJECT_NAME_NOT_FOUND' || code === 'STATUS_OBJECT_PATH_NOT_FOUND'\n ? wrapError(error, 'ENOENT')\n : code === 'STATUS_OBJECT_NAME_COLLISION'\n ? wrapError(error, 'EEXIST')\n : code === 'STATUS_NOT_SUPPORTED' || code === 'STATUS_INVALID_PARAMETER'\n ? wrapError(error, shouldBeDirectory ? 'ENOTDIR' : 'EISDIR')\n : error\n}\nconst normalizeDirError = error => normalizeError(error, true)\n\nexport default class SmbHandler extends RemoteHandlerAbstract {\n constructor(remote, opts) {\n super(remote, opts)\n\n // defined in _sync()\n this._client = undefined\n\n const prefix = this._remote.path\n this._prefix = prefix !== '' ? prefix + '\\\\' : prefix\n }\n\n get type() {\n return 'smb'\n }\n\n _getFilePath(file) {\n return this._prefix + (typeof file === 'string' ? file : file.path).slice(1).replace(/\\//g, '\\\\')\n }\n\n _dirname(file) {\n const parts = file.split('\\\\')\n parts.pop()\n return parts.join('\\\\')\n }\n\n _closeFile(file) {\n return this._client.close(file).catch(normalizeError)\n }\n\n _createReadStream(file, options) {\n if (typeof file === 'string') {\n file = this._getFilePath(file)\n } else {\n options = { autoClose: false, ...options, fd: file.fd }\n file = ''\n }\n return this._client.createReadStream(file, options).catch(normalizeError)\n }\n\n _createWriteStream(file, options) {\n if (typeof file === 'string') {\n file = this._getFilePath(file)\n } else {\n options = { autoClose: false, ...options, fd: file.fd }\n file = ''\n }\n return this._client.createWriteStream(file, options).catch(normalizeError)\n }\n\n _forget() {\n const client = this._client\n this._client = undefined\n return client.disconnect()\n }\n\n _getSize(file) {\n return this._client.getSize(this._getFilePath(file)).catch(normalizeError)\n }\n\n _list(dir) {\n return this._client.readdir(this._getFilePath(dir)).catch(normalizeDirError)\n }\n\n _mkdir(dir, { mode }) {\n return this._client.mkdir(this._getFilePath(dir), mode).catch(normalizeDirError)\n }\n\n // TODO: add flags\n _openFile(path, flags) {\n return this._client.open(this._getFilePath(path), flags).catch(normalizeError)\n }\n\n async _read(file, buffer, position) {\n const client = this._client\n const needsClose = typeof file === 'string'\n file = needsClose ? await client.open(this._getFilePath(file)) : file.fd\n try {\n return await client.read(file, buffer, 0, buffer.length, position)\n } catch (error) {\n normalizeError(error)\n } finally {\n if (needsClose) {\n await client.close(file)\n }\n }\n }\n\n _readFile(file, options) {\n return this._client.readFile(this._getFilePath(file), options).catch(normalizeError)\n }\n\n _rename(oldPath, newPath) {\n return this._client\n .rename(this._getFilePath(oldPath), this._getFilePath(newPath), {\n replace: true,\n })\n .catch(normalizeError)\n }\n\n _rmdir(dir) {\n return this._client.rmdir(this._getFilePath(dir)).catch(normalizeDirError)\n }\n\n _sync() {\n const remote = this._remote\n\n this._client = new Smb2({\n share: `\\\\\\\\${remote.host}`,\n domain: remote.domain,\n username: remote.username,\n password: remote.password,\n autoCloseTimeout: 0,\n })\n\n // Check access (smb2 does not expose connect in public so far...)\n return this.list('.')\n }\n\n _truncate(file, len) {\n return this._client.truncate(this._getFilePath(file), len).catch(normalizeError)\n }\n\n _unlink(file) {\n return this._client.unlink(this._getFilePath(file)).catch(normalizeError)\n }\n\n _writeFd(file, buffer, position) {\n return this._client.write(file.fd, buffer, 0, buffer.length, position)\n }\n\n _writeFile(file, data, options) {\n return this._client.writeFile(this._getFilePath(file), data, options).catch(normalizeError)\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAGA,MAAMA,SAAS,GAAG,CAACC,KAAD,EAAQC,IAAR,MAAkB;EAClCC,SAAS,EAAEF,KADuB;EAElCG,KAAK,EAAEH,KAF2B;EAGlCC;AAHkC,CAAlB,CAAlB;;AAKA,MAAMG,cAAc,GAAG,CAACJ,KAAD,EAAQK,iBAAR,KAA8B;EACnD,MAAM;IAAEJ;EAAF,IAAWD,KAAjB;EAEA,MAAMC,IAAI,KAAK,4BAAT,GACFF,SAAS,CAACC,KAAD,EAAQ,WAAR,CADP,GAEFC,IAAI,KAAK,4BAAT,GACAF,SAAS,CAACC,KAAD,EAAQ,QAAR,CADT,GAEAC,IAAI,KAAK,wBAAT,GACAF,SAAS,CAACC,KAAD,EAAQ,SAAR,CADT,GAEAC,IAAI,KAAK,8BAAT,IAA2CA,IAAI,KAAK,8BAApD,GACAF,SAAS,CAACC,KAAD,EAAQ,QAAR,CADT,GAEAC,IAAI,KAAK,8BAAT,GACAF,SAAS,CAACC,KAAD,EAAQ,QAAR,CADT,GAEAC,IAAI,KAAK,sBAAT,IAAmCA,IAAI,KAAK,0BAA5C,GACAF,SAAS,CAACC,KAAD,EAAQK,iBAAiB,GAAG,SAAH,GAAe,QAAxC,CADT,GAEAL,KAZJ;AAaD,CAhBD;;AAiBA,MAAMM,iBAAiB,GAAGN,KAAK,IAA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jE,YAAL,CAAkBC,IAAlB,CAAvB,EAAgD+D,IAAhD,EAAsDnD,OAAtD,EAA+DF,KAA/D,CAAqE1B,cAArE,CAAP;EACD;;AApI2D"}
|
|
1
|
+
{"version":3,"file":"smb.js","names":["SmbHandler","MountHandler","constructor","remote","opts","domain","host","password","path","username","parse","url","type","device","normalize","options","env","USER","PASSWD"],"sources":["../src/smb.js"],"sourcesContent":["import { parse } from 'xo-remote-parser'\n\nimport MountHandler from './_mount'\nimport { normalize } from './path'\n\nexport default class SmbHandler extends MountHandler {\n constructor(remote, opts) {\n const { domain = 'WORKGROUP', host, password, path, username } = parse(remote.url)\n super(remote, opts, {\n type: 'cifs',\n device: '//' + host + normalize(path),\n options: `domain=${domain}`,\n env: {\n USER: username,\n PASSWD: password,\n },\n })\n }\n\n get type() {\n return 'smb'\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;AAEe,MAAMA,UAAN,SAAyBC,cAAzB,CAAsC;EACnDC,WAAW,CAACC,MAAD,EAASC,IAAT,EAAe;IACxB,MAAM;MAAEC,MAAM,GAAG,WAAX;MAAwBC,IAAxB;MAA8BC,QAA9B;MAAwCC,IAAxC;MAA8CC;IAA9C,IAA2D,IAAAC,qBAAA,EAAMP,MAAM,CAACQ,GAAb,CAAjE;IACA,MAAMR,MAAN,EAAcC,IAAd,EAAoB;MAClBQ,IAAI,EAAE,MADY;MAElBC,MAAM,EAAE,OAAOP,IAAP,GAAc,IAAAQ,eAAA,EAAUN,IAAV,CAFJ;MAGlBO,OAAO,EAAG,UAASV,MAAO,EAHR;MAIlBW,GAAG,EAAE;QACHC,IAAI,EAAER,QADH;QAEHS,MAAM,EAAEX;MAFL;IAJa,CAApB;EASD;;EAEO,IAAJK,IAAI,GAAG;IACT,OAAO,KAAP;EACD;;AAhBkD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@xen-orchestra/fs",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"description": "The File System for Xen Orchestra backups.",
|
|
7
7
|
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/fs",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"xo-fs": "./cli.js"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=14"
|
|
20
|
+
"node": ">=14.13"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@aws-sdk/client-s3": "^3.54.0",
|
|
24
24
|
"@aws-sdk/lib-storage": "^3.54.0",
|
|
25
25
|
"@aws-sdk/middleware-apply-body-checksum": "^3.58.0",
|
|
26
26
|
"@aws-sdk/node-http-handler": "^3.54.0",
|
|
27
|
-
"@marsaud/smb2": "^0.18.0",
|
|
28
27
|
"@sindresorhus/df": "^3.1.1",
|
|
29
28
|
"@vates/async-each": "^1.0.0",
|
|
30
29
|
"@vates/coalesce-calls": "^0.1.0",
|
|
31
30
|
"@vates/decorate-with": "^2.0.0",
|
|
31
|
+
"@vates/read-chunk": "^1.0.0",
|
|
32
32
|
"@xen-orchestra/async-map": "^0.1.2",
|
|
33
33
|
"@xen-orchestra/log": "^0.3.0",
|
|
34
34
|
"bind-property-descriptor": "^2.0.0",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"lodash": "^4.17.4",
|
|
41
41
|
"promise-toolbox": "^0.21.0",
|
|
42
42
|
"proper-lockfile": "^4.1.2",
|
|
43
|
-
"
|
|
43
|
+
"pumpify": "^2.0.1",
|
|
44
|
+
"readable-stream": "^4.1.0",
|
|
44
45
|
"through2": "^4.0.2",
|
|
45
46
|
"xo-remote-parser": "^0.9.1"
|
|
46
47
|
},
|
|
@@ -67,5 +68,9 @@
|
|
|
67
68
|
"author": {
|
|
68
69
|
"name": "Vates SAS",
|
|
69
70
|
"url": "https://vates.fr"
|
|
71
|
+
},
|
|
72
|
+
"exports": {
|
|
73
|
+
".": "./dist/index.js",
|
|
74
|
+
"./path": "./dist/path.js"
|
|
70
75
|
}
|
|
71
76
|
}
|
package/dist/_path.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_path.js","names":["basename","dirname","join","resolve","sep","path","posix","normalize","split","parts","shift"],"sources":["../src/_path.js"],"sourcesContent":["import path from 'path'\n\nconst { basename, dirname, join, resolve, sep } = path.posix\n\nexport { basename, dirname, join }\n\n// normalize the path:\n// - does not contains `.` or `..` (cannot escape root dir)\n// - always starts with `/`\n// - no trailing slash (expect for root)\n// - no duplicate slashes\nexport const normalize = path => resolve('/', path)\n\nexport function split(path) {\n const parts = normalize(path).split(sep)\n\n // remove first (empty) entry\n parts.shift()\n\n return parts\n}\n"],"mappings":";;;;;;;;AAAA;;;;AAEA,MAAM;EAAEA,QAAF;EAAYC,OAAZ;EAAqBC,IAArB;EAA2BC,OAA3B;EAAoCC;AAApC,IAA4CC,aAAA,CAAKC,KAAvD;;;;;AASO,MAAMC,SAAS,GAAGF,IAAI,IAAIF,OAAO,CAAC,GAAD,EAAME,IAAN,CAAjC;;;;AAEA,SAASG,KAAT,CAAeH,IAAf,EAAqB;EAC1B,MAAMI,KAAK,GAAGF,SAAS,CAACF,IAAD,CAAT,CAAgBG,KAAhB,CAAsBJ,GAAtB,CAAd;EAGAK,KAAK,CAACC,KAAN;EAEA,OAAOD,KAAP;AACD"}
|
package/dist/smb-mount.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _xoRemoteParser = require("xo-remote-parser");
|
|
9
|
-
|
|
10
|
-
var _mount = _interopRequireDefault(require("./_mount"));
|
|
11
|
-
|
|
12
|
-
var _path = require("./_path");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
class SmbMountHandler extends _mount.default {
|
|
17
|
-
constructor(remote, opts) {
|
|
18
|
-
const {
|
|
19
|
-
domain = 'WORKGROUP',
|
|
20
|
-
host,
|
|
21
|
-
password,
|
|
22
|
-
path,
|
|
23
|
-
username
|
|
24
|
-
} = (0, _xoRemoteParser.parse)(remote.url);
|
|
25
|
-
super(remote, opts, {
|
|
26
|
-
type: 'cifs',
|
|
27
|
-
device: '//' + host + (0, _path.normalize)(path),
|
|
28
|
-
options: `domain=${domain}`,
|
|
29
|
-
env: {
|
|
30
|
-
USER: username,
|
|
31
|
-
PASSWD: password
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get type() {
|
|
37
|
-
return 'smb';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.default = SmbMountHandler;
|
|
43
|
-
//# sourceMappingURL=smb-mount.js.map
|
package/dist/smb-mount.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smb-mount.js","names":["SmbMountHandler","MountHandler","constructor","remote","opts","domain","host","password","path","username","parse","url","type","device","normalize","options","env","USER","PASSWD"],"sources":["../src/smb-mount.js"],"sourcesContent":["import { parse } from 'xo-remote-parser'\n\nimport MountHandler from './_mount'\nimport { normalize } from './_path'\n\nexport default class SmbMountHandler extends MountHandler {\n constructor(remote, opts) {\n const { domain = 'WORKGROUP', host, password, path, username } = parse(remote.url)\n super(remote, opts, {\n type: 'cifs',\n device: '//' + host + normalize(path),\n options: `domain=${domain}`,\n env: {\n USER: username,\n PASSWD: password,\n },\n })\n }\n\n get type() {\n return 'smb'\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;AAEe,MAAMA,eAAN,SAA8BC,cAA9B,CAA2C;EACxDC,WAAW,CAACC,MAAD,EAASC,IAAT,EAAe;IACxB,MAAM;MAAEC,MAAM,GAAG,WAAX;MAAwBC,IAAxB;MAA8BC,QAA9B;MAAwCC,IAAxC;MAA8CC;IAA9C,IAA2D,IAAAC,qBAAA,EAAMP,MAAM,CAACQ,GAAb,CAAjE;IACA,MAAMR,MAAN,EAAcC,IAAd,EAAoB;MAClBQ,IAAI,EAAE,MADY;MAElBC,MAAM,EAAE,OAAOP,IAAP,GAAc,IAAAQ,eAAA,EAAUN,IAAV,CAFJ;MAGlBO,OAAO,EAAG,UAASV,MAAO,EAHR;MAIlBW,GAAG,EAAE;QACHC,IAAI,EAAER,QADH;QAEHS,MAAM,EAAEX;MAFL;IAJa,CAApB;EASD;;EAEO,IAAJK,IAAI,GAAG;IACT,OAAO,KAAP;EACD;;AAhBuD"}
|