Skip to content

Commit a72448b

Browse files
Implement LargeFileUploadTask
1 parent acedfc1 commit a72448b

21 files changed

+615
-11
lines changed

browser-wrapper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
// make MicrosoftGraph globally accessible
22
// MicrosoftGraph.api() can be called directly
3-
window.MicrosoftGraph = require('./lib/src/index.js');
3+
window.MicrosoftGraph = require('./lib/src/index.js');
4+
Object.assign(window, require("./lib/src/LargeFileUploadTask.js"));

lib/graph-js-sdk-web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/LargeFileUploadTask.d.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Client } from "./index";
2+
import { Range } from "./Range";
3+
interface LargeFileUploadTaskOptions {
4+
sessionRequestUrl: string;
5+
rangeSize?: number;
6+
maxTries?: number;
7+
}
8+
interface LargeFileUploadSession {
9+
url: string;
10+
expiry: Date;
11+
}
12+
export declare class LargeFileUploadTask {
13+
client: Client;
14+
file: File;
15+
options: LargeFileUploadTaskOptions;
16+
uploadSession: LargeFileUploadSession;
17+
nextRange: Range;
18+
constructor(client: Client, file: File, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions);
19+
static create(client: Client, file: File | Blob, options: LargeFileUploadTaskOptions): Promise<any>;
20+
static createUploadSession(client: Client, requestUrl: string, requestPayload: any): Promise<any>;
21+
private parseRange;
22+
private updateTaskStatus;
23+
getNextRange(): Range;
24+
sliceFile(range: Range): Blob;
25+
upload(): Promise<any>;
26+
uploadSlice(fileSlice: Blob | File, range: Range, totalSize: number): Promise<any>;
27+
cancel(): Promise<any>;
28+
getStatus(): Promise<any>;
29+
resume(): Promise<any>;
30+
commit(requestUrl: string): Promise<any>;
31+
}
32+
export {};

lib/src/LargeFileUploadTask.js

Lines changed: 304 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/LargeFileUploadTask.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)