Skip to content
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

encode format question! #8

Open
hxzAugustinus opened this issue Jul 19, 2017 · 2 comments
Open

encode format question! #8

hxzAugustinus opened this issue Jul 19, 2017 · 2 comments

Comments

@hxzAugustinus
Copy link

hxzAugustinus commented Jul 19, 2017

when i use it to download txt File,i found that in the onprogress callback has question:

fileTransfer.onprogress = function(progress) {   
    //the  progress.total   sometimes  may be wrong; i try  it 10 times ,it  is  wrong  5~6  times
    console.log(progress.total);
}

Txt has the four encode format :ANSI ,unicode ,unicode big endian and utf-8 , i try it with different
encode , but it shows Irregular.

@hxzAugustinus
Copy link
Author

hxzAugustinus commented Jul 19, 2017

这个问题很微妙,用英语难以描述,所以用中文,复述一遍:当我没有使用你的这个插件时,使用cordova-plugin-file-transfer 下载时,它有以下规律:
下载一个100kb 的 txt , progress 中正确的total 应该是 100*1024 ,但是,有时它会小于102400,比如只有 102400/4= 25600 , 但是它对应的loaded值也会除以相同的倍率4,所以尽管值的大小不对,但依然可以正常工作;
但我使用你写的插件后,progress 中total值等于25600 , 但是它对应的loaded值并没有除以相同的倍率4,导致下载出错(即loaded/total > 1),这个错误不是稳定出现的,但一般卸载重新安装后的第一次大概率会出现错误。

@vaenow
Copy link
Owner

vaenow commented Jul 21, 2017

不好意思,你的问题描述得很清楚,不过我现在没办法复现它,所以不知道到底是哪里的问题。
此插件是基于 cordova-plugin-file-transfer,只是修改了它的断点下载的参数
如果可以,希望你能把这个问题找出来 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants