Skip to content

Choose a tag to compare

@github-actions github-actions released this 30 Sep 13:51
fd675b9

A rewrite. The 0.x API is still available from node-scp/legacy; see
docs/migration/from-0.x.md.

Breaking changes

  • New API: connect() returns a client with upload, download, writeFile, readFile and
    fs. The 0.x Client moved to node-scp/legacy.
  • Every error is a ScpError with a stable code and the original error as cause.
  • Destinations are exact paths, and remote parent directories must exist.
  • Node.js 20 or newer is required.

Features

  • Real SCP protocol support for servers without SFTP, such as Dropbear, OpenWrt and network
    devices. protocol: 'auto' (the default) prefers SFTP and falls back to SCP.
  • Transfer options for both protocols: recursive, concurrency, filter, preserve,
    onProgress and signal.
  • writeFile and readFile for buffers and streams. A stream with size must match it
    exactly, otherwise the write fails with ERR_INVALID_ARGUMENT.
  • await using support through Symbol.asyncDispose.
  • One shot upload() and download() helpers that take user@host:path.
  • TCP_NODELAY by default, which makes many small transfers an order of magnitude faster.
  • node-scp/scp2, a drop in replacement for the unmaintained scp2 package.
  • A node-scp command line tool and a GitHub Action.
  • ES modules and CommonJS builds with bundled types, published with npm provenance.
  • ssh2 updated to ^1.17.0.

Fixes

  • Names received from the server, in SCP records and SFTP directory listings, are validated,
    so a malicious server cannot write outside the destination.
  • New copies get the source permission bits over both protocols, like scp and sftp.
    setuid, setgid and sticky bits only travel with preserve.
  • Connection errors after ready no longer crash the process when nobody listens for error.
  • The greeting event is no longer emitted as banner.