@spinajs/fs-ftp 2.0.482 → 2.0.485
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/cjs/index.d.ts +144 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +386 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +1 -0
- package/lib/mjs/index.d.ts +144 -0
- package/lib/mjs/index.d.ts.map +1 -0
- package/lib/mjs/index.js +380 -0
- package/lib/mjs/index.js.map +1 -0
- package/lib/mjs/package.json +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/tsconfig.mjs.tsbuildinfo +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Log } from '@spinajs/log-common';
|
|
2
|
+
import { fs, IStat, IZipResult, FileInfoService } from '@spinajs/fs';
|
|
3
|
+
import { Client } from 'basic-ftp';
|
|
4
|
+
interface IFtpConfig {
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
user: string;
|
|
8
|
+
password: string;
|
|
9
|
+
secure?: boolean;
|
|
10
|
+
logVerbose: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Abstract layer for file operations.
|
|
15
|
+
* Basic implementation is just wrapper for native node fs functions
|
|
16
|
+
*
|
|
17
|
+
* It allows to wrap other libs eg. aws s3, ftp
|
|
18
|
+
* and inject it into code without changing logic that use them.
|
|
19
|
+
*
|
|
20
|
+
* TODO: map errors to some kind of common errors shared with other implementations
|
|
21
|
+
*/
|
|
22
|
+
export declare class fsFTP extends fs {
|
|
23
|
+
Options: IFtpConfig;
|
|
24
|
+
protected Logger: Log;
|
|
25
|
+
protected FileInfo: FileInfoService;
|
|
26
|
+
/**
|
|
27
|
+
* File system for temporary files
|
|
28
|
+
*/
|
|
29
|
+
protected TempFs: fs;
|
|
30
|
+
protected FtpClient: Client;
|
|
31
|
+
/**
|
|
32
|
+
* Name of provider. We can have multiple providers of the same type but with different options.
|
|
33
|
+
* Also used in InjectService decorator for mapping
|
|
34
|
+
*/
|
|
35
|
+
get Name(): string;
|
|
36
|
+
constructor(Options: IFtpConfig);
|
|
37
|
+
protected _ensureDir(dir: string): Promise<void>;
|
|
38
|
+
protected _setWorkingDir(dir: string): Promise<void>;
|
|
39
|
+
protected _restoreRootDir(): Promise<void>;
|
|
40
|
+
resolve(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* Tries to download file to local filesystem, then returns local filesystem path.
|
|
44
|
+
* Native implementation simply returns local path and does nothing.
|
|
45
|
+
*
|
|
46
|
+
* @param path - file to download
|
|
47
|
+
*/
|
|
48
|
+
download(p: string): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* read all content of file
|
|
51
|
+
*/
|
|
52
|
+
read(path: string, encoding: BufferEncoding): Promise<string | Buffer<ArrayBufferLike>>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns a readable stream with the remote file content.
|
|
55
|
+
*
|
|
56
|
+
* NOTE: basic-ftp runs one command at a time on a single connection - do not
|
|
57
|
+
* issue other operations on this provider until the stream is fully consumed.
|
|
58
|
+
*/
|
|
59
|
+
readStream(p: string, encoding?: BufferEncoding): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Write to file string or buffer
|
|
62
|
+
*/
|
|
63
|
+
write(dstPath: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @param path
|
|
66
|
+
* @param data
|
|
67
|
+
* @param encoding
|
|
68
|
+
*/
|
|
69
|
+
append(dstPath: string, data: string | Buffer, encoding?: BufferEncoding): Promise<void>;
|
|
70
|
+
upload(srcPath: string, destPath?: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* Returns writable stream for given path
|
|
74
|
+
*
|
|
75
|
+
* @param path file path ( relative to base path of provider)
|
|
76
|
+
* @param rStream readable stream, must be provided beforehand
|
|
77
|
+
* @param encoding optional stream encoding
|
|
78
|
+
*/
|
|
79
|
+
writeStream(_path: string, _encoding?: BufferEncoding | NodeJS.ReadableStream, _enc?: BufferEncoding): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Checks if file existst
|
|
82
|
+
* @param path - path to check
|
|
83
|
+
*/
|
|
84
|
+
exists(p: string): Promise<boolean>;
|
|
85
|
+
dirExists(p: string): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Copy file to another location of fs
|
|
88
|
+
*
|
|
89
|
+
* FTP implementation does not support copying locally, so we must download it locally, then copy onto ftp server
|
|
90
|
+
*
|
|
91
|
+
* @param path - src path
|
|
92
|
+
* @param dest - dest path
|
|
93
|
+
* @param dstFs - destination file system ( optional )
|
|
94
|
+
*/
|
|
95
|
+
copy(path: string, dest: string, dstFs?: fs): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Copy file to another location and deletes src file
|
|
98
|
+
*/
|
|
99
|
+
move(oldPath: string, newPath: string, dstFs?: fs): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Change name of a file
|
|
102
|
+
*/
|
|
103
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* Deletes dir recursively & all contents inside
|
|
107
|
+
*
|
|
108
|
+
* @param path - dir to remove
|
|
109
|
+
*/
|
|
110
|
+
rm(p: string): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* Creates directory, recursively
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
mkdir(path: string): Promise<void>;
|
|
117
|
+
isDir(dir: string): Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns file statistics, not all fields may be accesible
|
|
120
|
+
*/
|
|
121
|
+
stat(file: string): Promise<IStat>;
|
|
122
|
+
tmppath(): string;
|
|
123
|
+
/**
|
|
124
|
+
* List content of directory
|
|
125
|
+
*
|
|
126
|
+
* @param path - path to directory
|
|
127
|
+
*/
|
|
128
|
+
list(dir: string): Promise<string[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Downloads the zip to the local temp fs and extracts it there.
|
|
131
|
+
* Destination fs must be a local-path filesystem ( defaults to the temp fs ) -
|
|
132
|
+
* extracting directly onto the ftp server is not supported.
|
|
133
|
+
*/
|
|
134
|
+
unzip(srcPath: string, destPath?: string, dstFs?: fs): Promise<string>;
|
|
135
|
+
/**
|
|
136
|
+
* Downloads given remote files to the local temp fs and zips them there.
|
|
137
|
+
* Result is created on dstFs ( defaults to the temp fs ). Entry names are the
|
|
138
|
+
* remote path basenames.
|
|
139
|
+
*/
|
|
140
|
+
zip(p: string | (string | string[])[], dstFs?: fs, dstFile?: string): Promise<IZipResult>;
|
|
141
|
+
resolvePath(_path: string): string;
|
|
142
|
+
}
|
|
143
|
+
export {};
|
|
144
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMnC,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,qBAEa,KAAM,SAAQ,EAAE;IAuBR,OAAO,EAAE,UAAU;IArBtC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IA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IACU,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;IAiBxD;;OAEG;IACU,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;IAkB9D;;OAEG;IACU,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAIpD;;;;;OAKG;IACU,EAAE,CAAC,CAAC,EAAE,MAAM;IAMzB;;;;OAIG;IACU,KAAK,CAAC,IAAI,EAAE,MAAM;IAIlB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKjD;;OAEG;IACU,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAmBxC,OAAO,IAAI,MAAM;IAIxB;;;;OAIG;IACU,IAAI,CAAC,GAAG,EAAE,MAAM;IAM7B;;;;OAIG;IACU,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAcnF;;;;OAIG;IACU,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAwB/F,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAS1C"}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.fsFTP = void 0;
|
|
16
|
+
const di_1 = require("@spinajs/di");
|
|
17
|
+
const log_common_1 = require("@spinajs/log-common");
|
|
18
|
+
const fs_1 = require("@spinajs/fs");
|
|
19
|
+
const basic_ftp_1 = require("basic-ftp");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
22
|
+
const luxon_1 = require("luxon");
|
|
23
|
+
const stream_1 = require("stream");
|
|
24
|
+
/**
|
|
25
|
+
* Abstract layer for file operations.
|
|
26
|
+
* Basic implementation is just wrapper for native node fs functions
|
|
27
|
+
*
|
|
28
|
+
* It allows to wrap other libs eg. aws s3, ftp
|
|
29
|
+
* and inject it into code without changing logic that use them.
|
|
30
|
+
*
|
|
31
|
+
* TODO: map errors to some kind of common errors shared with other implementations
|
|
32
|
+
*/
|
|
33
|
+
let fsFTP = class fsFTP extends fs_1.fs {
|
|
34
|
+
/**
|
|
35
|
+
* Name of provider. We can have multiple providers of the same type but with different options.
|
|
36
|
+
* Also used in InjectService decorator for mapping
|
|
37
|
+
*/
|
|
38
|
+
get Name() {
|
|
39
|
+
return this.Options.name;
|
|
40
|
+
}
|
|
41
|
+
constructor(Options) {
|
|
42
|
+
super();
|
|
43
|
+
this.Options = Options;
|
|
44
|
+
}
|
|
45
|
+
async _ensureDir(dir) {
|
|
46
|
+
const dstDir = path_1.default.dirname(dir);
|
|
47
|
+
await this.FtpClient.ensureDir(dstDir);
|
|
48
|
+
await this._setWorkingDir(dir);
|
|
49
|
+
}
|
|
50
|
+
async _setWorkingDir(dir) {
|
|
51
|
+
const dstDir = path_1.default.dirname(dir);
|
|
52
|
+
await this.FtpClient.cd(dstDir === '.' ? dstDir : `/${dstDir}`);
|
|
53
|
+
}
|
|
54
|
+
async _restoreRootDir() {
|
|
55
|
+
const pwd = await this.FtpClient.pwd();
|
|
56
|
+
if (pwd !== '/') {
|
|
57
|
+
const paths = pwd.split('/');
|
|
58
|
+
for (let index = 0; index < paths.length; index++) {
|
|
59
|
+
await this.FtpClient.cd('..');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async resolve() {
|
|
64
|
+
await super.resolve();
|
|
65
|
+
this.FtpClient = new basic_ftp_1.Client();
|
|
66
|
+
this.FtpClient.ftp.verbose = this.Options.logVerbose;
|
|
67
|
+
this.FtpClient.ftp.log = (msg) => {
|
|
68
|
+
this.Logger.debug(msg);
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
await this.FtpClient.access({
|
|
72
|
+
host: this.Options.host,
|
|
73
|
+
port: this.Options.port ?? 21,
|
|
74
|
+
user: this.Options.user,
|
|
75
|
+
password: this.Options.password,
|
|
76
|
+
secure: this.Options.secure ?? false,
|
|
77
|
+
});
|
|
78
|
+
this.Logger.info(`Connected to ftp server at ${this.Options.host}:${this.Options.port}`);
|
|
79
|
+
this.FtpClient.trackProgress((info) => {
|
|
80
|
+
const cmd = info.name ? `file: ${info.name}` : `command: ${info.type}`;
|
|
81
|
+
this.Logger.debug(`Progress - ${cmd}, transferred: ${info.bytes} of total ${info.bytesOverall} bytes`);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
throw new exceptions_1.IOFail(`Cannot connect to ftp server: ${e.message}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* Tries to download file to local filesystem, then returns local filesystem path.
|
|
91
|
+
* Native implementation simply returns local path and does nothing.
|
|
92
|
+
*
|
|
93
|
+
* @param path - file to download
|
|
94
|
+
*/
|
|
95
|
+
async download(p) {
|
|
96
|
+
const tmpName = this.TempFs.tmppath();
|
|
97
|
+
const wStream = await this.TempFs.writeStream(tmpName);
|
|
98
|
+
await this._restoreRootDir();
|
|
99
|
+
await this._setWorkingDir(p);
|
|
100
|
+
await this.FtpClient.downloadTo(wStream, path_1.default.basename(p));
|
|
101
|
+
this.Logger.debug(`Downloaded file ${p} to ${tmpName}`);
|
|
102
|
+
return tmpName;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* read all content of file
|
|
106
|
+
*/
|
|
107
|
+
async read(path, encoding) {
|
|
108
|
+
const tmpName = await this.download(path);
|
|
109
|
+
const data = await this.TempFs.read(tmpName, encoding);
|
|
110
|
+
await this.TempFs.rm(tmpName);
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns a readable stream with the remote file content.
|
|
115
|
+
*
|
|
116
|
+
* NOTE: basic-ftp runs one command at a time on a single connection - do not
|
|
117
|
+
* issue other operations on this provider until the stream is fully consumed.
|
|
118
|
+
*/
|
|
119
|
+
async readStream(p, encoding) {
|
|
120
|
+
const pass = new stream_1.PassThrough();
|
|
121
|
+
if (encoding) {
|
|
122
|
+
pass.setEncoding(encoding);
|
|
123
|
+
}
|
|
124
|
+
await this._restoreRootDir();
|
|
125
|
+
await this._setWorkingDir(p);
|
|
126
|
+
this.FtpClient.downloadTo(pass, path_1.default.basename(p)).catch((err) => {
|
|
127
|
+
pass.destroy(err instanceof Error ? err : new exceptions_1.IOFail(`Cannot read stream from ${p}`, err));
|
|
128
|
+
});
|
|
129
|
+
return pass;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Write to file string or buffer
|
|
133
|
+
*/
|
|
134
|
+
async write(dstPath, data, encoding) {
|
|
135
|
+
await this._restoreRootDir();
|
|
136
|
+
await this._ensureDir(dstPath);
|
|
137
|
+
await this.FtpClient.uploadFrom(stream_1.Readable.from(data, { encoding }), path_1.default.basename(dstPath));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @param path
|
|
141
|
+
* @param data
|
|
142
|
+
* @param encoding
|
|
143
|
+
*/
|
|
144
|
+
async append(dstPath, data, encoding) {
|
|
145
|
+
await this._restoreRootDir();
|
|
146
|
+
await this._ensureDir(dstPath);
|
|
147
|
+
// use the FTP APPE command ( appendFrom ) so data is appended to the existing
|
|
148
|
+
// remote file. After _ensureDir the working dir is the file's parent, so the
|
|
149
|
+
// remote target must be the basename.
|
|
150
|
+
await this.FtpClient.appendFrom(stream_1.Readable.from(data, { encoding }), path_1.default.basename(dstPath));
|
|
151
|
+
}
|
|
152
|
+
async upload(srcPath, destPath) {
|
|
153
|
+
await this._restoreRootDir();
|
|
154
|
+
if (!destPath) {
|
|
155
|
+
destPath = path_1.default.basename(srcPath);
|
|
156
|
+
}
|
|
157
|
+
await this._ensureDir(destPath);
|
|
158
|
+
// upload under the destination file name, not the source name. _ensureDir has
|
|
159
|
+
// already switched into destPath's parent directory, so pass the destination basename.
|
|
160
|
+
await this.FtpClient.uploadFrom(srcPath, path_1.default.basename(destPath));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
* Returns writable stream for given path
|
|
165
|
+
*
|
|
166
|
+
* @param path file path ( relative to base path of provider)
|
|
167
|
+
* @param rStream readable stream, must be provided beforehand
|
|
168
|
+
* @param encoding optional stream encoding
|
|
169
|
+
*/
|
|
170
|
+
async writeStream(_path, _encoding, _enc) {
|
|
171
|
+
throw new exceptions_1.MethodNotImplemented('fs ftp does not support writing streams');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Checks if file existst
|
|
175
|
+
* @param path - path to check
|
|
176
|
+
*/
|
|
177
|
+
async exists(p) {
|
|
178
|
+
try {
|
|
179
|
+
await this._restoreRootDir();
|
|
180
|
+
await this._setWorkingDir(p);
|
|
181
|
+
const result = await this.stat(path_1.default.basename(p));
|
|
182
|
+
if (!result) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return result.IsFile ?? false;
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async dirExists(p) {
|
|
192
|
+
try {
|
|
193
|
+
await this._restoreRootDir();
|
|
194
|
+
await this._setWorkingDir(p);
|
|
195
|
+
const result = await this.stat(path_1.default.basename(p));
|
|
196
|
+
return !!(result && result.IsDirectory);
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Copy file to another location of fs
|
|
204
|
+
*
|
|
205
|
+
* FTP implementation does not support copying locally, so we must download it locally, then copy onto ftp server
|
|
206
|
+
*
|
|
207
|
+
* @param path - src path
|
|
208
|
+
* @param dest - dest path
|
|
209
|
+
* @param dstFs - destination file system ( optional )
|
|
210
|
+
*/
|
|
211
|
+
async copy(path, dest, dstFs) {
|
|
212
|
+
let tmpFile = '';
|
|
213
|
+
try {
|
|
214
|
+
tmpFile = await this.download(path);
|
|
215
|
+
if (dstFs) {
|
|
216
|
+
await dstFs.upload(tmpFile, dest);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
await this.FtpClient.uploadFrom(tmpFile, dest);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
if (tmpFile) {
|
|
224
|
+
await this.TempFs.rm(tmpFile);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Copy file to another location and deletes src file
|
|
230
|
+
*/
|
|
231
|
+
async move(oldPath, newPath, dstFs) {
|
|
232
|
+
if (dstFs) {
|
|
233
|
+
let tmpFile = '';
|
|
234
|
+
try {
|
|
235
|
+
tmpFile = await this.download(oldPath);
|
|
236
|
+
await dstFs.upload(tmpFile, newPath);
|
|
237
|
+
await this.FtpClient.remove(oldPath);
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
if (tmpFile) {
|
|
241
|
+
await this.TempFs.rm(tmpFile);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// rename also can move file betwen directories
|
|
247
|
+
await this.FtpClient.rename(oldPath, newPath);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Change name of a file
|
|
252
|
+
*/
|
|
253
|
+
async rename(oldPath, newPath) {
|
|
254
|
+
await this.FtpClient.rename(oldPath, newPath);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
*
|
|
258
|
+
* Deletes dir recursively & all contents inside
|
|
259
|
+
*
|
|
260
|
+
* @param path - dir to remove
|
|
261
|
+
*/
|
|
262
|
+
async rm(p) {
|
|
263
|
+
await this._restoreRootDir();
|
|
264
|
+
await this._setWorkingDir(p);
|
|
265
|
+
await this.FtpClient.remove(path_1.default.basename(p));
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
*
|
|
269
|
+
* Creates directory, recursively
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
async mkdir(path) {
|
|
273
|
+
await this.FtpClient.ensureDir(path);
|
|
274
|
+
}
|
|
275
|
+
async isDir(dir) {
|
|
276
|
+
const stat = await this.stat(dir);
|
|
277
|
+
return stat.IsDirectory ?? false;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Returns file statistics, not all fields may be accesible
|
|
281
|
+
*/
|
|
282
|
+
async stat(file) {
|
|
283
|
+
await this.FtpClient.cd(path_1.default.dirname(file));
|
|
284
|
+
const files = await this.FtpClient.list(path_1.default.basename(file));
|
|
285
|
+
const found = files.find((f) => f.name === path_1.default.basename(file));
|
|
286
|
+
if (found) {
|
|
287
|
+
return {
|
|
288
|
+
IsDirectory: found.isDirectory,
|
|
289
|
+
IsFile: found.isFile,
|
|
290
|
+
Size: found.size,
|
|
291
|
+
AccessTime: undefined,
|
|
292
|
+
ModifiedTime: luxon_1.DateTime.fromJSDate(found.modifiedAt),
|
|
293
|
+
CreationTime: undefined,
|
|
294
|
+
AdditionalData: found,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
tmppath() {
|
|
300
|
+
throw new exceptions_1.MethodNotImplemented('fs ftp does not support temporary paths');
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* List content of directory
|
|
304
|
+
*
|
|
305
|
+
* @param path - path to directory
|
|
306
|
+
*/
|
|
307
|
+
async list(dir) {
|
|
308
|
+
await this.FtpClient.cd(path_1.default.dirname(dir));
|
|
309
|
+
const files = await this.FtpClient.list(path_1.default.basename(dir));
|
|
310
|
+
return files.map((f) => f.name);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Downloads the zip to the local temp fs and extracts it there.
|
|
314
|
+
* Destination fs must be a local-path filesystem ( defaults to the temp fs ) -
|
|
315
|
+
* extracting directly onto the ftp server is not supported.
|
|
316
|
+
*/
|
|
317
|
+
async unzip(srcPath, destPath, dstFs) {
|
|
318
|
+
const local = await this.download(srcPath);
|
|
319
|
+
try {
|
|
320
|
+
return await this.TempFs.unzip(local, destPath, dstFs ?? this.TempFs);
|
|
321
|
+
}
|
|
322
|
+
finally {
|
|
323
|
+
try {
|
|
324
|
+
await this.TempFs.rm(local);
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
/* best effort cleanup */
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Downloads given remote files to the local temp fs and zips them there.
|
|
333
|
+
* Result is created on dstFs ( defaults to the temp fs ). Entry names are the
|
|
334
|
+
* remote path basenames.
|
|
335
|
+
*/
|
|
336
|
+
async zip(p, dstFs, dstFile) {
|
|
337
|
+
const paths = Array.isArray(p) ? p : [p];
|
|
338
|
+
const downloaded = [];
|
|
339
|
+
try {
|
|
340
|
+
for (const entry of paths) {
|
|
341
|
+
const remote = Array.isArray(entry) ? entry[0] : entry;
|
|
342
|
+
const entryName = Array.isArray(entry) ? entry[1] : entry;
|
|
343
|
+
const local = await this.download(remote);
|
|
344
|
+
downloaded.push([local, entryName]);
|
|
345
|
+
}
|
|
346
|
+
return await this.TempFs.zip(downloaded, dstFs ?? this.TempFs, dstFile);
|
|
347
|
+
}
|
|
348
|
+
finally {
|
|
349
|
+
for (const [local] of downloaded) {
|
|
350
|
+
try {
|
|
351
|
+
await this.TempFs.rm(local);
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
/* best effort cleanup */
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
resolvePath(_path) {
|
|
360
|
+
// we checek if path is absolute
|
|
361
|
+
// for hash function
|
|
362
|
+
if (path_1.default.isAbsolute(_path)) {
|
|
363
|
+
return _path;
|
|
364
|
+
}
|
|
365
|
+
throw new exceptions_1.MethodNotImplemented('fs ftp does not support path resolving');
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
exports.fsFTP = fsFTP;
|
|
369
|
+
__decorate([
|
|
370
|
+
(0, log_common_1.Logger)('fs'),
|
|
371
|
+
__metadata("design:type", log_common_1.Log)
|
|
372
|
+
], fsFTP.prototype, "Logger", void 0);
|
|
373
|
+
__decorate([
|
|
374
|
+
(0, di_1.Autoinject)(),
|
|
375
|
+
__metadata("design:type", fs_1.FileInfoService)
|
|
376
|
+
], fsFTP.prototype, "FileInfo", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
(0, fs_1.FileSystem)('fs-temp'),
|
|
379
|
+
__metadata("design:type", fs_1.fs)
|
|
380
|
+
], fsFTP.prototype, "TempFs", void 0);
|
|
381
|
+
exports.fsFTP = fsFTP = __decorate([
|
|
382
|
+
(0, di_1.Injectable)('fs'),
|
|
383
|
+
(0, di_1.PerInstanceCheck)(),
|
|
384
|
+
__metadata("design:paramtypes", [Object])
|
|
385
|
+
], fsFTP);
|
|
386
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oCAAuE;AACvE,oDAAkD;AAClD,oCAAiF;AACjF,yCAAmC;AACnC,gDAAwB;AACxB,oDAAmE;AACnE,iCAAiC;AACjC,mCAA+C;AAY/C;;;;;;;;GAQG;AAGI,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,OAAE;IAe3B;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,YAAmB,OAAmB;QACpC,KAAK,EAAE,CAAC;QADS,YAAO,GAAP,OAAO,CAAY;IAEtC,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,GAAW;QACpC,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAES,KAAK,CAAC,cAAc,CAAC,GAAW;QACxC,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IA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