Files and directories
Upload and download individual files or recursive directory trees.
Secure SSH transfers for Node.js
scp-next uploads and downloads files or
directories from a CLI, ESM import, or CommonJS require. Local and remote
paths stay explicit, and sensitive values are redacted from logs and
errors.
One package for command-line transfers and reusable TypeScript integrations.
Upload and download individual files or recursive directory trees.
Use profiles, jobs, environment variables, and explicit precedence.
Connect once, transfer multiple paths, run commands, and close reliably.
Consume the same public API through import or require.
Resolve and validate CLI operations before connecting or transferring.
Verify host keys with fingerprints or known-hosts files. Follow the host verification troubleshooting guide if verification fails.
Install globally for CLI use or add the package to a Node.js project.
npm install --global scp-next
scp-next --help
npm install scp-next
Upload uses a local source and remote destination. Download reverses that mapping.
scp-next upload ./dist /var/www/example \
--host your-host \
--username your-username \
--recursive \
--dry-run
import { upload } from "scp-next";
await upload({
host: process.env.SCP_NEXT_HOST,
username: process.env.SCP_NEXT_USERNAME,
password: process.env.SCP_NEXT_PASSWORD,
localPath: "./dist",
remotePath: "/var/www/example",
recursive: true
});
Supported browsers can install this website, examples, and API reference for quick access. Installing the documentation does not install the npm package or grant SSH access.