Skip to content

Commit 4e66c23

Browse files
authored
correcting file upload errror text, large file readme (#512)
1 parent b072596 commit 4e66c23

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/tasks/LargeFileUploadTask.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ import * as fs from "fs";
8787
const fileName = "<FILE_NAME>";
8888
const stats = fs.statSync(`./test/sample_files/${fileName}`);
8989
const totalsize = stats.size;
90-
const readStream = fs.readFileSync(`./test/sample_files/${fileName}`);
91-
const fileObject = new FileUpload(readStream, fileName, totalsize);
90+
const fileContent = fs.readFileSync(`./test/sample_files/${fileName}`);
91+
const fileObject = new FileUpload(fileContent, fileName, totalsize);
9292
```
9393

9494
**_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.
@@ -114,7 +114,7 @@ const options: LargeFileUploadTaskOptions = {
114114
**Create a LargefileUploadTask object**
115115

116116
```typescript
117-
const uploadTask = new LargeFileUploadTask(client, fileObj, uploadSession, optionsWithProgress);
117+
const uploadTask = new LargeFileUploadTask(client, fileObject, uploadSession, optionsWithProgress);
118118
const uploadResult: UploadResult = await uploadTask.upload();
119119
```
120120

@@ -141,8 +141,8 @@ const options: OneDriveLargeFileUploadOptions = {
141141
const readStream = fs.createReadStream(`./fileName`);
142142
const fileObject = new StreamUpload(readStream, fileName, totalsize);
143143
or
144-
const readFile = fs.readFileSync(`./fileName`);
145-
const fileObject = new FileUpload(readStream, fileName, totalsize);
144+
const uploadContent = fs.readFileSync(`./fileName`);
145+
const fileObject = new FileUpload(uploadContent, fileName, totalsize);
146146

147147
const uploadTask = await OneDriveLargeFileUploadTask.createTaskWithFileObject(client, fileObject, options);
148148
const uploadResult:UploadResult = await uploadTask.upload();

src/tasks/FileUploadTask/FileObjectClasses/FileUpload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class FileUpload implements FileObject<SliceType> {
2525
*/
2626
public constructor(public content: ArrayBuffer | Blob | Buffer, public name: string, public size: number) {
2727
if (!content || !name || !size) {
28-
throw new GraphClientError("Please provide the Readable Stream content, name of the file and size of the file");
28+
throw new GraphClientError("Please provide the upload content, name of the file and size of the file");
2929
}
3030
}
3131

0 commit comments

Comments
 (0)