-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement maxUploadFileSize
#256
Changes from 9 commits
d617e36
5eb4dc1
680fe92
52dc4c7
d038235
2af220f
8d9191a
a623d48
c6b6678
f7a0493
e3450a0
159f040
c404117
4254181
05ee163
a51b537
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,14 @@ export function getDriverClass(driver: DriverName): DriverConstructor & DriverSt | |
} | ||
} | ||
|
||
export function megabytesToBytes(megabytes: number) { | ||
return megabytes * 1024 * 1024 | ||
} | ||
|
||
export function bytesToMegabytes(bytes: number, decimals = 2) { | ||
return Number.parseFloat((bytes / 1024 / 1024).toFixed(decimals)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a bug, but I'd prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
} | ||
|
||
export function dateToUnixTimeSeconds(date: Date) { | ||
return Math.round(date.getTime() / 1000) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should mention somewhere in the README that a
Content-Length
header is necessary -- there's no support for chunked encoding.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per my comment #256 (comment)
I removed the requirement for providing a content-length header. After extensive testing, this is a frustrating header to provide given CORs whitelist contraints. Additionally, it excludes future uploading features that do not necessarily know the content length in advance.