Skip to content

Commit

Permalink
修复单位比较错误的问题 (#453)
Browse files Browse the repository at this point in the history
* fix review

* import MB unit
  • Loading branch information
winddies authored Jun 24, 2020
1 parent 0d1d24e commit 1b81947
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "qiniu-js",
"jsName": "qiniu",
"version": "3.0.1",
"version": "3.0.2",
"private": false,
"description": "Javascript SDK for Qiniu Resource (Cloud) Storage AP",
"main": "lib/index.js",
Expand Down
5 changes: 3 additions & 2 deletions src/upload/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Resume from './resume'
import Direct from './direct'
import { UploadOptions, UploadHandler, DEFAULT_CHUNK_SIZE } from './base'
import { UploadOptions, UploadHandler } from './base'
import StatisticsLogger from '../statisticsLog'
import { MB } from '../utils'

export * from './base'
export * from './resume'
Expand All @@ -15,7 +16,7 @@ export default function createUploadManager(
return new Direct(options, handlers, statisticsLogger)
}

return options.file.size > DEFAULT_CHUNK_SIZE
return options.file.size > 4 * MB
? new Resume(options, handlers, statisticsLogger)
: new Direct(options, handlers, statisticsLogger)
}
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SparkMD5 from 'spark-md5'
import { Progress, LocalInfo } from './upload'
import { urlSafeBase64Decode } from './base64'

const MB = 1024 ** 2
export const MB = 1024 ** 2

// 文件分块
export function getChunks(file: File, blockSize: number): Blob[] {
Expand Down

0 comments on commit 1b81947

Please sign in to comment.