This repository has been archived by the owner on Feb 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from Kinvey/MLIBZ-2575
MLIBZ-2575: Calculate file size
- Loading branch information
Showing
9 changed files
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ export { | |
DataStoreType, | ||
SyncOperation, | ||
LiveService, | ||
Files, | ||
Log, | ||
Metadata, | ||
Query, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ export { | |
DataStoreType, | ||
SyncOperation, | ||
LiveService, | ||
Files, | ||
Log, | ||
Metadata, | ||
Query, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ export { | |
DataStoreType, | ||
SyncOperation, | ||
LiveService, | ||
Files, | ||
Log, | ||
Metadata, | ||
Query, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ export { | |
DataStoreType, | ||
SyncOperation, | ||
LiveService, | ||
Files, | ||
Log, | ||
Metadata, | ||
Query, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import isString from 'lodash/isString'; | ||
import { FileStore as CoreFilesStore } from '../core/files'; | ||
import { KinveyError } from '../core/errors'; | ||
|
||
export class FilesStore extends CoreFilesStore { | ||
upload(file, metadata = {}, options) { | ||
if (!(file instanceof global.Blob) && !isString(file)) { | ||
return Promise.reject(new KinveyError('File must be an instance of a Blob or the content of the file as a string.')); | ||
} | ||
|
||
metadata.size = file.size || file.length; | ||
return super.upload(file, metadata, options); | ||
} | ||
} | ||
|
||
export const Files = new FilesStore(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters