Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/tasks/LargeFileUploadTask.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ import * as fs from "fs";
const fileName = "<FILE_NAME>";
const stats = fs.statSync(`./test/sample_files/${fileName}`);
const totalsize = stats.size;
const readStream = fs.readFileSync(`./test/sample_files/${fileName}`);
const fileObject = new FileUpload(readStream, fileName, totalsize);
const fileContent = fs.readFileSync(`./test/sample_files/${fileName}`);
const fileObject = new FileUpload(fileContent, fileName, totalsize);
```

**_Note_** - You can also have a customized `FileObject` implementation which contains the `sliceFile(range: Range)` function which implements the logic to split the file into ranges.
Expand All @@ -114,7 +114,7 @@ const options: LargeFileUploadTaskOptions = {
**Create a LargefileUploadTask object**

```typescript
const uploadTask = new LargeFileUploadTask(client, fileObj, uploadSession, optionsWithProgress);
const uploadTask = new LargeFileUploadTask(client, fileObject, uploadSession, optionsWithProgress);
const uploadResult: UploadResult = await uploadTask.upload();
```

Expand All @@ -141,8 +141,8 @@ const options: OneDriveLargeFileUploadOptions = {
const readStream = fs.createReadStream(`./fileName`);
const fileObject = new StreamUpload(readStream, fileName, totalsize);
or
const readFile = fs.readFileSync(`./fileName`);
const fileObject = new FileUpload(readStream, fileName, totalsize);
const uploadContent = fs.readFileSync(`./fileName`);
const fileObject = new FileUpload(uploadContent, fileName, totalsize);

const uploadTask = await OneDriveLargeFileUploadTask.createTaskWithFileObject(client, fileObject, options);
const uploadResult:UploadResult = await uploadTask.upload();
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/FileUploadTask/FileObjectClasses/FileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class FileUpload implements FileObject<SliceType> {
*/
public constructor(public content: ArrayBuffer | Blob | Buffer, public name: string, public size: number) {
if (!content || !name || !size) {
throw new GraphClientError("Please provide the Readable Stream content, name of the file and size of the file");
throw new GraphClientError("Please provide the upload content, name of the file and size of the file");
}
}

Expand Down