@@ -51,11 +51,11 @@ interface OneDriveFileUploadSessionPayLoad {
51
51
/**
52
52
* @interface
53
53
* Signature to define the file information when processing an upload task
54
- * @property {File | Buffer } content - The file content
54
+ * @property {File | Uint8Array } content - The file content
55
55
* @property {number } size - The size of file
56
56
*/
57
57
interface FileInfo {
58
- content : File | Buffer ;
58
+ content : File | Uint8Array ;
59
59
size : number ;
60
60
}
61
61
@@ -103,11 +103,11 @@ export class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {
103
103
* @private
104
104
* @static
105
105
* Get file information
106
- * @param {Blob | Buffer | File } file - The file entity
106
+ * @param {Blob | Uint8Array | File } file - The file entity
107
107
* @param {string } fileName - The file name
108
108
* @returns {FileInfo } The file information
109
109
*/
110
- private static getFileInfo ( file : Blob | Buffer | File , fileName : string ) : FileInfo {
110
+ private static getFileInfo ( file : Blob | Uint8Array | File , fileName : string ) : FileInfo {
111
111
let content ;
112
112
let size ;
113
113
if ( typeof Blob !== "undefined" && file instanceof Blob ) {
@@ -116,8 +116,8 @@ export class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {
116
116
} else if ( typeof File !== "undefined" && file instanceof File ) {
117
117
content = file as File ;
118
118
size = content . size ;
119
- } else if ( typeof Buffer !== "undefined" && file instanceof Buffer ) {
120
- const b = file as Buffer ;
119
+ } else if ( typeof Uint8Array !== "undefined" && file instanceof Uint8Array ) {
120
+ const b = file as Uint8Array ;
121
121
size = b . byteLength ;
122
122
content = b . buffer . slice ( b . byteOffset , b . byteOffset + b . byteLength ) ;
123
123
}
@@ -133,18 +133,18 @@ export class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {
133
133
* @async
134
134
* Creates a OneDriveLargeFileUploadTask
135
135
* @param {Client } client - The GraphClient instance
136
- * @param {Blob | Buffer | File } file - File represented as Blob, Buffer or File
136
+ * @param {Blob | Uint8Array | File } file - File represented as Blob, Uint8Array or File
137
137
* @param {OneDriveLargeFileUploadOptions } options - The options for upload task
138
138
* @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
139
139
*/
140
- public static async create ( client : Client , file : Blob | Buffer | File , options : OneDriveLargeFileUploadOptions ) : Promise < OneDriveLargeFileUploadTask < Blob | ArrayBuffer | Buffer > > {
140
+ public static async create ( client : Client , file : Blob | Uint8Array | File , options : OneDriveLargeFileUploadOptions ) : Promise < OneDriveLargeFileUploadTask < Blob | ArrayBuffer | Uint8Array > > {
141
141
if ( ! client || ! file || ! options ) {
142
142
throw new GraphClientError ( "Please provide the Graph client instance, file object and OneDriveLargeFileUploadOptions value" ) ;
143
143
}
144
144
const fileName = options . fileName ;
145
145
const fileInfo = OneDriveLargeFileUploadTask . getFileInfo ( file , fileName ) ;
146
146
const fileObj = new FileUpload ( fileInfo . content , fileName , fileInfo . size ) ;
147
- return this . createTaskWithFileObject < Blob | ArrayBuffer | Buffer > ( client , fileObj , options ) ;
147
+ return this . createTaskWithFileObject < Blob | ArrayBuffer | Uint8Array > ( client , fileObj , options ) ;
148
148
}
149
149
150
150
/**
0 commit comments