Skip to content

修复单位比较错误的问题 #453

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

Merged
merged 2 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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