@edirect/sftp-client 11.0.48 → 11.0.49
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/README.md +19 -19
- package/dist/README.md +19 -19
- package/dist/package.json +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -72,15 +72,15 @@ export class ReportService {
|
|
|
72
72
|
|
|
73
73
|
## Connection Options (`ISFTPClientOptions`)
|
|
74
74
|
|
|
75
|
-
| Option
|
|
76
|
-
|
|
77
|
-
| `host`
|
|
78
|
-
| `port`
|
|
79
|
-
| `username`
|
|
80
|
-
| `password`
|
|
81
|
-
| `privateKey` | `string \| Buffer` | No
|
|
82
|
-
| `passphrase` | `string`
|
|
83
|
-
| `encoding`
|
|
75
|
+
| Option | Type | Required | Description |
|
|
76
|
+
| ------------ | ------------------ | -------- | ---------------------------------------- |
|
|
77
|
+
| `host` | `string` | Yes | SFTP server hostname or IP |
|
|
78
|
+
| `port` | `string` | Yes | SFTP server port (usually `'22'`) |
|
|
79
|
+
| `username` | `string` | Yes | SSH username |
|
|
80
|
+
| `password` | `string` | No | Password authentication |
|
|
81
|
+
| `privateKey` | `string \| Buffer` | No | Private key for key-based authentication |
|
|
82
|
+
| `passphrase` | `string` | No | Passphrase for the private key |
|
|
83
|
+
| `encoding` | `string` | No | File encoding |
|
|
84
84
|
|
|
85
85
|
Either `password` or `privateKey` must be provided.
|
|
86
86
|
|
|
@@ -88,15 +88,15 @@ Either `password` or `privateKey` must be provided.
|
|
|
88
88
|
|
|
89
89
|
### `SftpClientService`
|
|
90
90
|
|
|
91
|
-
| Method
|
|
92
|
-
|
|
93
|
-
| `upload`
|
|
94
|
-
| `download`
|
|
95
|
-
| `delete`
|
|
96
|
-
| `rename`
|
|
97
|
-
| `posixRename`
|
|
98
|
-
| `listFiles`
|
|
99
|
-
| `getFileContent` | `(options, filePath: string): Promise<string>`
|
|
91
|
+
| Method | Signature | Description |
|
|
92
|
+
| ---------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
|
|
93
|
+
| `upload` | `(options, dataToUpload: string \| Buffer, fileName: string): Promise<void>` | Upload content to `fileName` on the SFTP server |
|
|
94
|
+
| `download` | `(options, fileName: string, downloadPath: string \| WritableStream): Promise<void>` | Download `fileName` to a local path or writable stream |
|
|
95
|
+
| `delete` | `(options, deletePath: string): Promise<void>` | Delete a file at the given path |
|
|
96
|
+
| `rename` | `(options, fromPath: string, toPath: string): Promise<void>` | Rename a file |
|
|
97
|
+
| `posixRename` | `(options, fromPath: string, toPath: string): Promise<void>` | Rename using POSIX atomic rename (server-side) |
|
|
98
|
+
| `listFiles` | `(options, path: string, orderByModifiedDate?: 'ASC' \| 'DESC'): Promise<string[]>` | List filenames in a directory, optionally sorted by modification time |
|
|
99
|
+
| `getFileContent` | `(options, filePath: string): Promise<string>` | Read and return file content as a UTF-8 string |
|
|
100
100
|
|
|
101
101
|
> Each method opens a new SFTP connection, performs the operation, and closes the connection. This avoids stale connection issues in long-running services.
|
|
102
102
|
|
|
@@ -130,6 +130,6 @@ await sftp.upload(
|
|
|
130
130
|
passphrase: process.env.SSH_PASSPHRASE,
|
|
131
131
|
},
|
|
132
132
|
fileContent,
|
|
133
|
-
'/uploads/report.csv'
|
|
133
|
+
'/uploads/report.csv',
|
|
134
134
|
);
|
|
135
135
|
```
|
package/dist/README.md
CHANGED
|
@@ -72,15 +72,15 @@ export class ReportService {
|
|
|
72
72
|
|
|
73
73
|
## Connection Options (`ISFTPClientOptions`)
|
|
74
74
|
|
|
75
|
-
| Option
|
|
76
|
-
|
|
77
|
-
| `host`
|
|
78
|
-
| `port`
|
|
79
|
-
| `username`
|
|
80
|
-
| `password`
|
|
81
|
-
| `privateKey` | `string \| Buffer` | No
|
|
82
|
-
| `passphrase` | `string`
|
|
83
|
-
| `encoding`
|
|
75
|
+
| Option | Type | Required | Description |
|
|
76
|
+
| ------------ | ------------------ | -------- | ---------------------------------------- |
|
|
77
|
+
| `host` | `string` | Yes | SFTP server hostname or IP |
|
|
78
|
+
| `port` | `string` | Yes | SFTP server port (usually `'22'`) |
|
|
79
|
+
| `username` | `string` | Yes | SSH username |
|
|
80
|
+
| `password` | `string` | No | Password authentication |
|
|
81
|
+
| `privateKey` | `string \| Buffer` | No | Private key for key-based authentication |
|
|
82
|
+
| `passphrase` | `string` | No | Passphrase for the private key |
|
|
83
|
+
| `encoding` | `string` | No | File encoding |
|
|
84
84
|
|
|
85
85
|
Either `password` or `privateKey` must be provided.
|
|
86
86
|
|
|
@@ -88,15 +88,15 @@ Either `password` or `privateKey` must be provided.
|
|
|
88
88
|
|
|
89
89
|
### `SftpClientService`
|
|
90
90
|
|
|
91
|
-
| Method
|
|
92
|
-
|
|
93
|
-
| `upload`
|
|
94
|
-
| `download`
|
|
95
|
-
| `delete`
|
|
96
|
-
| `rename`
|
|
97
|
-
| `posixRename`
|
|
98
|
-
| `listFiles`
|
|
99
|
-
| `getFileContent` | `(options, filePath: string): Promise<string>`
|
|
91
|
+
| Method | Signature | Description |
|
|
92
|
+
| ---------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
|
|
93
|
+
| `upload` | `(options, dataToUpload: string \| Buffer, fileName: string): Promise<void>` | Upload content to `fileName` on the SFTP server |
|
|
94
|
+
| `download` | `(options, fileName: string, downloadPath: string \| WritableStream): Promise<void>` | Download `fileName` to a local path or writable stream |
|
|
95
|
+
| `delete` | `(options, deletePath: string): Promise<void>` | Delete a file at the given path |
|
|
96
|
+
| `rename` | `(options, fromPath: string, toPath: string): Promise<void>` | Rename a file |
|
|
97
|
+
| `posixRename` | `(options, fromPath: string, toPath: string): Promise<void>` | Rename using POSIX atomic rename (server-side) |
|
|
98
|
+
| `listFiles` | `(options, path: string, orderByModifiedDate?: 'ASC' \| 'DESC'): Promise<string[]>` | List filenames in a directory, optionally sorted by modification time |
|
|
99
|
+
| `getFileContent` | `(options, filePath: string): Promise<string>` | Read and return file content as a UTF-8 string |
|
|
100
100
|
|
|
101
101
|
> Each method opens a new SFTP connection, performs the operation, and closes the connection. This avoids stale connection issues in long-running services.
|
|
102
102
|
|
|
@@ -130,6 +130,6 @@ await sftp.upload(
|
|
|
130
130
|
passphrase: process.env.SSH_PASSPHRASE,
|
|
131
131
|
},
|
|
132
132
|
fileContent,
|
|
133
|
-
'/uploads/report.csv'
|
|
133
|
+
'/uploads/report.csv',
|
|
134
134
|
);
|
|
135
135
|
```
|
package/dist/package.json
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@nestjs/common": "^11.1.
|
|
20
|
-
"ssh2-sftp-client": "^12.0
|
|
19
|
+
"@nestjs/common": "^11.1.16",
|
|
20
|
+
"ssh2-sftp-client": "^12.1.0",
|
|
21
21
|
"tslib": "^2.8.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "^25.
|
|
24
|
+
"@types/node": "^25.4.0",
|
|
25
25
|
"@types/ssh2-sftp-client": "^9.0.6"
|
|
26
26
|
},
|
|
27
27
|
"type": "commonjs"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/sftp-client",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.49",
|
|
4
4
|
"packageScope": "@edirect",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@nestjs/common": "^11.1.
|
|
21
|
-
"ssh2-sftp-client": "^12.0
|
|
20
|
+
"@nestjs/common": "^11.1.16",
|
|
21
|
+
"ssh2-sftp-client": "^12.1.0",
|
|
22
22
|
"tslib": "^2.8.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^25.
|
|
25
|
+
"@types/node": "^25.4.0",
|
|
26
26
|
"@types/ssh2-sftp-client": "^9.0.6"
|
|
27
27
|
},
|
|
28
28
|
"nx": {
|