1 | ;
|
2 | /**
|
3 | * -------------------------------------------------------------------------------------------
|
4 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
5 | * See License in the project root for license information.
|
6 | * -------------------------------------------------------------------------------------------
|
7 | */
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | exports.FileUpload = void 0;
|
10 | var GraphClientError_1 = require("../../../GraphClientError");
|
11 | /**
|
12 | * @class
|
13 | * Class used for creating LargeFileUploadTask fileobject.
|
14 | * This class accepts files of type ArrayBuffer, Blob, Uint8Array.
|
15 | */
|
16 | var FileUpload = /** @class */ (function () {
|
17 | /**
|
18 | * @public
|
19 | * @constructor
|
20 | * @param {ArrayBuffer | Blob | Uint8Array} content - The file to be uploaded
|
21 | * @param {string} name - The name of the file to be uploaded
|
22 | * @param {number} size - The total size of the file to be uploaded
|
23 | * @returns An instance of the FileUpload class
|
24 | */
|
25 | function FileUpload(content, name, size) {
|
26 | this.content = content;
|
27 | this.name = name;
|
28 | this.size = size;
|
29 | if (!content || !name || !size) {
|
30 | throw new GraphClientError_1.GraphClientError("Please provide the upload content, name of the file and size of the file");
|
31 | }
|
32 | }
|
33 | /**
|
34 | * @public
|
35 | * Slices the file content to the given range
|
36 | * @param {Range} range - The range value
|
37 | * @returns The sliced file part
|
38 | */
|
39 | FileUpload.prototype.sliceFile = function (range) {
|
40 | return this.content.slice(range.minValue, range.maxValue + 1);
|
41 | };
|
42 | return FileUpload;
|
43 | }());
|
44 | exports.FileUpload = FileUpload;
|
45 | //# sourceMappingURL=FileUpload.js.map |
\ | No newline at end of file |