Skip to content

Commit ed14b49

Browse files
committed
docs: sizeUploaded and timeRemaining functions documentated.
1 parent 1fdb850 commit ed14b49

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ set singleFile to true.
142142
* `.removeFile(file)` Cancel upload of a specific `FlowFile` object on the list from the list.
143143
* `.getFromUniqueIdentifier(uniqueIdentifier)` Look up a `FlowFile` object by its unique identifier.
144144
* `.getSize()` Returns the total size of the upload in bytes.
145+
* `.sizeUploaded()` Returns the total size uploaded of all files in bytes.
146+
* `.timeRemaining()` Returns remaining time to upload all files in seconds. Accuracy is based on average speed. If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY`
145147

146148
#### Events
147149

@@ -155,11 +157,11 @@ added.
155157
* `.filesAdded(array, event)` Same as fileAdded, but used for multiple file validation.
156158
* `.filesSubmitted(array, event)` Can be used to start upload of currently added files.
157159
* `.fileRetry(file)` Something went wrong during upload of a specific file, uploading is being retried.
158-
* `.fileError(file, message)` An error occured during upload of a specific file.
160+
* `.fileError(file, message)` An error occurred during upload of a specific file.
159161
* `.uploadStart()` Upload has been started on the Flow object.
160162
* `.complete()` Uploading completed.
161163
* `.progress()` Uploading progress.
162-
* `.error(message, file)` An error, including fileError, occured.
164+
* `.error(message, file)` An error, including fileError, occurred.
163165
* `.catchAll(event, ...)` Listen to all the events listed above with the same callback function.
164166

165167
### FlowFile
@@ -189,8 +191,7 @@ FlowFile constructor can be accessed in `Flow.FlowFile`.
189191
* `.isUploading()` Returns a boolean indicating whether file chunks is uploading.
190192
* `.isComplete()` Returns a boolean indicating whether the file has completed uploading and received a server response.
191193
* `.sizeUploaded()` Returns size uploaded in bytes.
192-
* `.timeRemaining()` Returns remaining time to upload in seconds. Accuracy is based on average
193-
speed.
194+
* `.timeRemaining()` Returns remaining time to finish upload file in seconds. Accuracy is based on average speed. If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY`
194195
* `.getExtension()` Returns file extension in lowercase.
195196
* `.getType()` Returns file type.
196197

src/flow.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@
585585

586586
/**
587587
* Returns remaining time to upload all files in seconds. Accuracy is based on average speed.
588+
* If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY`
588589
* @function
589590
* @returns {number}
590591
*/
@@ -919,7 +920,8 @@
919920
},
920921

921922
/**
922-
* Time remaining in seconds
923+
* Returns remaining time to finish upload file in seconds. Accuracy is based on average speed.
924+
* If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY`
923925
* @function
924926
* @returns {number}
925927
*/

test/uploadSpec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,5 @@ describe('upload file', function() {
427427
expect(fileSecond.timeRemaining()).toBe(0);
428428
expect(flow.sizeUploaded()).toBe(15);
429429
expect(flow.timeRemaining()).toBe(0);
430-
431430
});
432431
});

0 commit comments

Comments
 (0)