scp-next 1.0.15 → 1.0.16
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 +35 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
`scp-next` is an SCP-style command-line tool and library for secure file transfers over SSH.
|
|
19
19
|
It uses SFTP internally through `ssh2-sftp-client` instead of implementing SCP or SFTP protocols manually.
|
|
20
|
-
Developer documentation is available at
|
|
20
|
+
Developer documentation is available at [GitHub Pages](https://chengchuu.github.io/scp-next/).
|
|
21
21
|
|
|
22
22
|
## Contents
|
|
23
23
|
|
|
@@ -51,7 +51,7 @@ npm install scp-next
|
|
|
51
51
|
|
|
52
52
|
## Quick Start
|
|
53
53
|
|
|
54
|
-
Upload
|
|
54
|
+
Upload a directory:
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
scp-next upload ./dist /var/www/example \
|
|
@@ -61,13 +61,13 @@ scp-next upload ./dist /var/www/example \
|
|
|
61
61
|
--recursive
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Download
|
|
64
|
+
Download a file:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
67
|
scp-next download /var/log/example.log ./logs/example.log \
|
|
68
68
|
--host your-host \
|
|
69
69
|
--username your-username \
|
|
70
|
-
--
|
|
70
|
+
--password your-password
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
Use the library:
|
|
@@ -78,7 +78,7 @@ import { upload } from "scp-next";
|
|
|
78
78
|
await upload({
|
|
79
79
|
host: process.env.SCP_NEXT_HOST,
|
|
80
80
|
username: process.env.SCP_NEXT_USERNAME,
|
|
81
|
-
|
|
81
|
+
password: process.env.SCP_NEXT_PASSWORD,
|
|
82
82
|
localPath: "./dist",
|
|
83
83
|
remotePath: "/var/www/example",
|
|
84
84
|
recursive: true,
|
|
@@ -108,6 +108,18 @@ Destination paths follow familiar `cp`/`scp` behavior. If the destination exists
|
|
|
108
108
|
|
|
109
109
|
### Upload Examples
|
|
110
110
|
|
|
111
|
+
Password authentication:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
scp-next upload ./dist /var/www/example \
|
|
115
|
+
--host your-host \
|
|
116
|
+
--username your-username \
|
|
117
|
+
--password your-password \
|
|
118
|
+
--recursive
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Private-key authentication:
|
|
122
|
+
|
|
111
123
|
```bash
|
|
112
124
|
scp-next upload ./dist /var/www/example \
|
|
113
125
|
--host your-host \
|
|
@@ -118,6 +130,17 @@ scp-next upload ./dist /var/www/example \
|
|
|
118
130
|
|
|
119
131
|
### Download Examples
|
|
120
132
|
|
|
133
|
+
Password authentication:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
scp-next download /var/log/example.log ./logs/example.log \
|
|
137
|
+
--host your-host \
|
|
138
|
+
--username your-username \
|
|
139
|
+
--password your-password
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Private-key authentication:
|
|
143
|
+
|
|
121
144
|
```bash
|
|
122
145
|
scp-next download /var/log/example.log ./logs/example.log \
|
|
123
146
|
--host your-host \
|
|
@@ -159,7 +182,7 @@ import { upload } from "scp-next";
|
|
|
159
182
|
await upload({
|
|
160
183
|
host: process.env.SCP_NEXT_HOST,
|
|
161
184
|
username: process.env.SCP_NEXT_USERNAME,
|
|
162
|
-
|
|
185
|
+
password: process.env.SCP_NEXT_PASSWORD,
|
|
163
186
|
localPath: "./dist",
|
|
164
187
|
remotePath: "/var/www/example",
|
|
165
188
|
recursive: true,
|
|
@@ -176,7 +199,7 @@ async function main() {
|
|
|
176
199
|
await download({
|
|
177
200
|
host: process.env.SCP_NEXT_HOST,
|
|
178
201
|
username: process.env.SCP_NEXT_USERNAME,
|
|
179
|
-
|
|
202
|
+
password: process.env.SCP_NEXT_PASSWORD,
|
|
180
203
|
remotePath: "/var/log/example.log",
|
|
181
204
|
localPath: "./logs/example.log"
|
|
182
205
|
});
|
|
@@ -196,7 +219,7 @@ import { createClient } from "scp-next";
|
|
|
196
219
|
const client = createClient({
|
|
197
220
|
host: process.env.SCP_NEXT_HOST,
|
|
198
221
|
username: process.env.SCP_NEXT_USERNAME,
|
|
199
|
-
|
|
222
|
+
password: process.env.SCP_NEXT_PASSWORD
|
|
200
223
|
});
|
|
201
224
|
|
|
202
225
|
try {
|
|
@@ -264,7 +287,7 @@ Example:
|
|
|
264
287
|
"host": "your-host",
|
|
265
288
|
"port": 22,
|
|
266
289
|
"username": "your-username",
|
|
267
|
-
"
|
|
290
|
+
"password": "your-password"
|
|
268
291
|
},
|
|
269
292
|
"transfer": {
|
|
270
293
|
"recursive": true,
|
|
@@ -298,7 +321,7 @@ and `hostFingerprint` are also supported for simple configuration files, but `se
|
|
|
298
321
|
"host": "your-host-a",
|
|
299
322
|
"port": 22,
|
|
300
323
|
"username": "your-username-a",
|
|
301
|
-
"
|
|
324
|
+
"password": "your-password-a"
|
|
302
325
|
},
|
|
303
326
|
"staging": {
|
|
304
327
|
"host": "your-host-b",
|
|
@@ -324,7 +347,7 @@ Jobs use `source` and `destination`; the `operation` determines which path is lo
|
|
|
324
347
|
"production": {
|
|
325
348
|
"host": "your-host",
|
|
326
349
|
"username": "your-username",
|
|
327
|
-
"
|
|
350
|
+
"password": "your-password"
|
|
328
351
|
}
|
|
329
352
|
},
|
|
330
353
|
"jobs": {
|
|
@@ -454,7 +477,7 @@ try {
|
|
|
454
477
|
await upload({
|
|
455
478
|
host: process.env.SCP_NEXT_HOST,
|
|
456
479
|
username: process.env.SCP_NEXT_USERNAME,
|
|
457
|
-
|
|
480
|
+
password: process.env.SCP_NEXT_PASSWORD,
|
|
458
481
|
localPath: "./dist",
|
|
459
482
|
remotePath: "/var/www/example"
|
|
460
483
|
});
|