UNPKG

3.69 kBTypeScriptView Raw
1/**
2 * -------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
4 * See License in the project root for license information.
5 * -------------------------------------------------------------------------------------------
6 */
7/// <reference types="node" />
8/**
9 * @module OneDriveLargeFileUploadTask
10 */
11import { Client } from "../index";
12import { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from "./LargeFileUploadTask";
13/**
14 * @interface
15 * Signature to define options when creating an upload task
16 * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)
17 * @property {string} [path] - The path to which the file needs to be uploaded
18 * @property {number} [rangeSize] - Specifies the range chunk size
19 */
20interface OneDriveLargeFileUploadOptions {
21 fileName: string;
22 path?: string;
23 rangeSize?: number;
24}
25/**
26 * @class
27 * Class representing OneDriveLargeFileUploadTask
28 */
29export declare class OneDriveLargeFileUploadTask extends LargeFileUploadTask {
30 /**
31 * @private
32 * @static
33 * Default path for the file being uploaded
34 */
35 private static DEFAULT_UPLOAD_PATH;
36 /**
37 * @private
38 * @static
39 * Constructs the create session url for Onedrive
40 * @param {string} fileName - The name of the file
41 * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload
42 * @returns The constructed create session url
43 */
44 private static constructCreateSessionUrl;
45 /**
46 * @public
47 * @static
48 * @async
49 * Creates a OneDriveLargeFileUploadTask
50 * @param {Client} client - The GraphClient instance
51 * @param {Blob | Buffer | File} file - File represented as Blob, Buffer or File
52 * @param {OneDriveLargeFileUploadOptions} options - The options for upload task
53 * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
54 */
55 static create(client: Client, file: Blob | Buffer | File, options: OneDriveLargeFileUploadOptions): Promise<any>;
56 /**
57 * @public
58 * @static
59 * @async
60 * Makes request to the server to create an upload session
61 * @param {Client} client - The GraphClient instance
62 * @param {string} requestUrl - The URL to create the upload session
63 * @param {string} fileName - The name of a file to upload, (with extension)
64 * @returns The promise that resolves to LargeFileUploadSession
65 */
66 static createUploadSession(client: Client, requestUrl: string, fileName: string): Promise<any>;
67 /**
68 * @public
69 * @constructor
70 * Constructs a OneDriveLargeFileUploadTask
71 * @param {Client} client - The GraphClient instance
72 * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded
73 * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done
74 * @param {LargeFileUploadTaskOptions} options - The upload task options
75 * @returns An instance of OneDriveLargeFileUploadTask
76 */
77 constructor(client: Client, file: FileObject, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions);
78 /**
79 * @public
80 * Commits upload session to end uploading
81 * @param {string} requestUrl - The URL to commit the upload session
82 * @returns The promise resolves to committed response
83 */
84 commit(requestUrl: string): Promise<any>;
85}
86export {};