scp-next 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/README.md +61 -42
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,20 +1,31 @@
1
1
  # scp-next
2
2
 
3
- `scp-next` is a SCP command-line tool and library for secure file transfers over SSH.
4
- The package uses SFTP internally through `ssh2-sftp-client` instead of implementing SCP or SFTP protocols manually.
3
+ [![npm version][npm-image]][npm-url]
4
+ [![license][license-image]][license-url]
5
+ [![node version][node-image]][npm-url]
6
+ [![module type][module-image]][npm-url]
7
+
8
+ [npm-image]: https://img.shields.io/npm/v/scp-next
9
+ [npm-url]: https://npmjs.org/package/scp-next
10
+ [license-image]: https://img.shields.io/npm/l/scp-next
11
+ [license-url]: https://github.com/chengchuu/scp-next
12
+ [node-image]: https://img.shields.io/node/v/scp-next
13
+ [module-image]: https://img.shields.io/badge/module-ESM%20%2B%20CJS-blue
14
+
15
+ `scp-next` is an SCP-style command-line tool and library for secure file transfers over SSH.
16
+ The package uses SFTP internally through `ssh2-sftp-client` instead of implementing SCP or
17
+ SFTP protocols manually.
5
18
 
6
19
  ## Features
7
20
 
8
- - Upload and download files.
9
- - Upload and download directories recursively.
10
- - CLI usage with `<source> <destination>` operands.
11
- - ESM `import` and CommonJS `require` library usage.
12
- - Reusable transfer client.
21
+ - Upload and download files or directories recursively.
22
+ - CLI usage with clear `<source> <destination>` operands.
23
+ - ESM `import` and CommonJS `require` support.
13
24
  - JSON configuration files, named profiles, and configured jobs.
14
- - Environment-variable based credentials.
25
+ - Environment-variable-based credentials.
15
26
  - Dry-run mode, progress callbacks, timeouts, overwrite control, and destination directory creation.
16
- - Typed errors with stable error codes.
17
27
  - Secret redaction for passwords, passphrases, and private-key contents.
28
+ - Reusable transfer client.
18
29
 
19
30
  ## Installation
20
31
 
@@ -31,14 +42,6 @@ scp-next download <source> <destination> [options]
31
42
  scp-next run <job> [source] [destination] [options]
32
43
  ```
33
44
 
34
- Terminology is intentionally consistent:
35
-
36
- ```text
37
- Operation Source Destination
38
- Upload Local Remote
39
- Download Remote Local
40
- ```
41
-
42
45
  CLI commands use `<source> <destination>`. Programmatic upload and download APIs use
43
46
  `localPath` and `remotePath`.
44
47
 
@@ -53,6 +56,20 @@ scp-next upload ./dist /var/www/example \
53
56
  --create-directories
54
57
  ```
55
58
 
59
+ Password authentication:
60
+
61
+ ```bash
62
+ scp-next upload ./dist /var/www/example \
63
+ --host example.com \
64
+ --username deploy \
65
+ --password "your-password" \
66
+ --recursive
67
+ ```
68
+
69
+ Password arguments are convenient, but they may be exposed through shell history and process
70
+ listings. Prefer `SCP_NEXT_PASSWORD`, SSH agents, or protected private-key files for shared
71
+ or production environments.
72
+
56
73
  ## Download Examples
57
74
 
58
75
  ```bash
@@ -65,30 +82,26 @@ scp-next download /var/log/example.log ./logs/example.log \
65
82
 
66
83
  ## CLI Options
67
84
 
68
- ```text
69
- --host
70
- --port
71
- --username
72
- --password
73
- --private-key
74
- --private-key-file
75
- --passphrase
76
- --config
77
- --profile
78
- --recursive
79
- --overwrite
80
- --create-directories
81
- --dry-run
82
- --timeout
83
- --verbose
84
- --quiet
85
- --help
86
- --version
87
- ```
88
-
89
- Avoid `--password` when possible because command-line arguments may be visible in shell
90
- history and process listings. Prefer environment variables, SSH agents, or protected
91
- private-key files.
85
+ | Option | Description |
86
+ | ------------------------------------- | ---------------------------------------------------------------------- |
87
+ | `--host <host>` | SSH server host. |
88
+ | `--port <port>` | SSH server port. Defaults to `22`. |
89
+ | `--username <username>` | SSH username. |
90
+ | `--password <password>` | SSH password. Prefer environment variables, SSH agents, or key files. |
91
+ | `--private-key <privateKey>` | Private-key content. Redacted from logs and errors. |
92
+ | `--private-key-file <privateKeyFile>` | Private-key file path. Supports `~` expansion. |
93
+ | `--passphrase <passphrase>` | Passphrase for an encrypted private key. |
94
+ | `--config <path>` | Explicit configuration file path. |
95
+ | `--profile <name>` | Named server profile from the configuration file. |
96
+ | `--recursive` | Transfer directories recursively. |
97
+ | `--overwrite` | Allow replacing existing destination files. |
98
+ | `--create-directories` | Create missing destination directories when supported. |
99
+ | `--dry-run` | Resolve and validate the operation without connecting or transferring. |
100
+ | `--timeout <milliseconds>` | Connection and operation timeout in milliseconds. |
101
+ | `--verbose` | Print non-sensitive diagnostic details. |
102
+ | `--quiet` | Disable progress and non-error output. |
103
+ | `--help` | Show command help. |
104
+ | `--version` | Show the package version. |
92
105
 
93
106
  ## Configuration Files
94
107
 
@@ -355,7 +368,13 @@ non-sensitive context.
355
368
  import { AuthenticationError, upload } from "scp-next";
356
369
 
357
370
  try {
358
- await upload({ localPath: "./dist", remotePath: "/var/www/example" });
371
+ await upload({
372
+ host: process.env.SCP_NEXT_HOST,
373
+ username: process.env.SCP_NEXT_USERNAME,
374
+ privateKeyFile: process.env.SCP_NEXT_PRIVATE_KEY_FILE,
375
+ localPath: "./dist",
376
+ remotePath: "/var/www/example"
377
+ });
359
378
  } catch (error) {
360
379
  if (error instanceof AuthenticationError) {
361
380
  console.error("SSH authentication failed.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scp-next",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A SCP CLI and library for secure SSH file transfers using SFTP.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",