Skip to main content

UploadFile

Uploads a file to the specified project.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const UploadFileRequest =
cloudApi.datasphere.project_data_service.UploadFileRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ProjectDataServiceClient);

const result = await client.uploadFile(
UploadFileRequest.fromPartial({
// metadata: {
// projectId: "projectId",
// path: "path",
// sizeBytes: 0
// },
// chunk: Buffer.from([])
})
);
console.log(result);
})();

UploadFileRequest

One of message

  • metadata : FileMetadata

    Metadata of the file to upload.

  • chunk : bytes

    Byte chunk of the file to upload.

FileMetadata

projectId : string

ID of the Project resource associated with the file.

path : string

File path.

sizeBytes : int64

File size in bytes.

UploadFileResponse

metadata : FileMetadata

Metadata of the uploaded file.

FileMetadata

projectId : string

ID of the Project resource associated with the file.

path : string

File path.

sizeBytes : int64

File size in bytes.