Skip to content

copyBetween

function copyBetween(options: CopyBetweenOptions): Promise<TransferReceipt>;

Defined in: src/client/operations.ts:196

Copies a file between two remote endpoints in a single call.

Both source and destination providers must be registered with the TransferClient. Streams are piped end-to-end without staging the file on the local disk.

ParameterTypeDescription
optionsCopyBetweenOptionsFriendly copy options.

Promise<TransferReceipt>

Receipt produced by the underlying transfer engine.

import {
copyBetween,
createS3ProviderFactory,
createSftpProviderFactory,
createTransferClient,
} from "@zero-transfer/sdk";
const client = createTransferClient({
providers: [createSftpProviderFactory(), createS3ProviderFactory()],
});
await copyBetween({
client,
source: {
path: "/exports/daily.csv",
profile: { host: "sftp.example.com", provider: "sftp", username: "etl" },
},
destination: {
path: "warehouse/daily.csv",
profile: { host: "warehouse", provider: "s3", s3: { region: "us-east-1" } },
},
});