Skip to content

uploadFile

function uploadFile(options: UploadFileOptions): Promise<TransferReceipt>;

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

Uploads a single local file to a remote endpoint.

The remote provider is resolved from destination.profile.provider, so any provider factory you registered with createTransferClient can be used as the destination.

ParameterTypeDescription
optionsUploadFileOptionsFriendly upload options.

Promise<TransferReceipt>

Receipt produced by the underlying transfer engine.

import {
createSftpProviderFactory,
createTransferClient,
uploadFile,
} from "@zero-transfer/sdk";
const client = createTransferClient({ providers: [createSftpProviderFactory()] });
await uploadFile({
client,
destination: {
path: "/uploads/report.csv",
profile: {
host: "sftp.example.com",
provider: "sftp",
username: "deploy",
ssh: { privateKey: { path: "./keys/id_ed25519" } },
},
},
localPath: "./out/report.csv",
});