Skip to content

Function: parseTarget() ​

ts
function parseTarget(value): RemoteTarget | undefined;

Parses a remote location the way scp writes it:

  • host:path, user@host:path, user@[::1]:path (path may be empty or relative)
  • scp://[user@]host[:port][/path] (the path after the first / is taken literally, so scp://host/var/www means /var/www)

Returns undefined when value is a local path.

Parameters ​

ParameterType
valuestring

Returns ​

RemoteTarget | undefined

Released under the MIT License.