vtlab-generic-functions 1.0.28 → 1.0.30

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.
@@ -228,6 +228,28 @@ class FTPClientV2 {
228
228
  throw new Error(`Failed to list files in folder on FTP server: ${error.message}`);
229
229
  }
230
230
  }
231
+
232
+ /**
233
+ * Moves a file inside the FTP server.
234
+ * @param {string} ftpPathOrigin The original path of the file.
235
+ * @param {string} ftpPathDestination The new path of the file.
236
+ * @returns {Promise<Object>} A Promise resolving to an object with move status.
237
+ * @throws {Error} If move fails.
238
+ */
239
+ async moveFileInsideFTP(ftpPathOrigin, ftpPathDestination) {
240
+ try {
241
+ if (!this._isConnected) {
242
+ await this.connect(this._ftpCredentials);
243
+ }
244
+ await this._ftpInstance.put(ftpPathOrigin, ftpPathDestination);
245
+ await this.deleteFile(ftpPathOrigin);
246
+ return { code: 200, message: "FTP successful moved" };
247
+ } catch (error) {
248
+ throw new Error(`Failed to move file inside FTP server: ${error.message}`);
249
+ }
250
+ }
251
+
252
+
231
253
  }
232
254
 
233
255
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtlab-generic-functions",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },