A go sdk for baidu netdisk open platform 百度网盘开放平台 Go SDK

Overview

Pan Go Sdk

该代码库为百度网盘开放平台Go语言的SDK,详细请参考官方技术文档https://pan.baidu.com/union/document/entrance

下载

使用Go mod

在您的项目中的go.mod文件内添加这行代码

require github.com/jsyzchen/pan v0.0.4

并在项目中引入github.com/jsyzchen/pan

import (
    "github.com/jsyzchen/pan/auth"
    "github.com/jsyzchen/pan/file"
)

不使用 Go mod

go get -u github.com/jsyzchen/pan/file

使用示例

参考代码

Comments
  • 下载100M+文件提示分片错误

    下载100M+文件提示分片错误

    你好,我这显示下载错误,帮忙看下呢 2022/03/12 09:42:59 isSupportRange: true 2022/03/12 09:42:59 downloadPart 2022/03/12 09:42:59 TotalPart: 13 2022/03/12 09:42:59 开始[9]下载from:93042153 to:103380169 2022/03/12 09:42:59 开始[0]下载from:0 to:10338016 2022/03/12 09:42:59 开始[4]下载from:41352068 to:51690084 2022/03/12 09:42:59 开始[1]下载from:10338017 to:20676033 2022/03/12 09:42:59 开始[2]下载from:20676034 to:31014050 2022/03/12 09:42:59 开始[3]下载from:31014051 to:41352067 2022/03/12 09:42:59 开始[6]下载from:62028102 to:72366118 2022/03/12 09:42:59 开始[5]下载from:51690085 to:62028101 2022/03/12 09:42:59 开始[7]下载from:72366119 to:82704135 2022/03/12 09:42:59 开始[8]下载from:82704136 to:93042152 2022/03/12 09:43:30 下载文件失败: 下载文件分片长度错误 {6 62028102 72366118 [] } 2022/03/12 09:43:30 下载文件失败: 下载文件分片长度错误 {0 0 10338016 [] } 2022/03/12 09:43:30 下载文件失败: 下载文件分片长度错误 {3 31014051 41352067 [] } 2022/03/12 09:43:30 开始[11]下载from:113718187 to:124056203 2022/03/12 09:43:30 开始[10]下载from:103380170 to:113718186 2022/03/12 09:43:30 开始[12]下载from:124056204 to:134394217 2022/03/12 09:43:30 下载文件失败: 下载文件分片长度错误 {7 72366119 82704135 [] } 2022/03/12 09:44:01 下载文件失败: 下载文件分片长度错误 {10 103380170 113718186 [] } 2022/03/12 09:44:01 下载文件失败: 下载文件分片长度错误 {12 124056204 134394217 [] } 2022/03/12 09:44:01 下载文件失败: 下载文件分片长度错误 {11 113718187 124056203 [] }

    opened by Mainintowhile 3
  • fix: 修复 request_id 超过 int 的 json 解析错误

    fix: 修复 request_id 超过 int 的 json 解析错误

    问题描述

    百度接口返回 request_id 很大,会出现超过 int 的情况,请求上传分片的时候出现;

    接口返回数据如下:

    {
        "return_type": 2,
        "errno": 0,
        "info": {
            "size": 7547995,
            "category": 4,
            "fs_id": 785594356004402,
            "request_id": 421551960496220000,
            "path": "/apps/LinkinStar/go.png",
            "isdir": 0,
            "mtime": 1619590738,
            "ctime": 1619590738,
            "md5": "e87cf9899p9898c6b279d5556b808cc6"
        },
        "request_id": 421551960496221378
    }
    

    复现方式

    无法每次准确复现,使用不同大小的文件进行上传,偶尔就能出现解析异常

    解决方式

    使用 float64 代替 int 解决,因为使用 uint64 还是会出现问题

    opened by LinkinStars 3
  • 下载文件403错误

    下载文件403错误

    go run .\main.go
    2021/03/22 20:51:34 isSupportRange: true
    2021/03/22 20:51:34 downloadPart
    2021/03/22 20:51:34 TotalPart: 100
    2021/03/22 20:51:34 开始[1]下载from:19189757 to:38379513   
    2021/03/22 20:51:34 开始[11]下载from:211087327 to:230277083
    2021/03/22 20:51:34 开始[6]下载from:115138542 to:134328298 
    2021/03/22 20:51:34 开始[14]下载from:268656598 to:287846354
    2021/03/22 20:51:34 开始[15]下载from:287846355 to:307036111
    2021/03/22 20:51:34 开始[3]下载from:57569271 to:76759027
    2021/03/22 20:51:34 开始[4]下载from:76759028 to:95948784
    2021/03/22 20:51:34 开始[5]下载from:95948785 to:115138541
    2021/03/22 20:51:34 开始[0]下载from:0 to:19189756
    2021/03/22 20:51:34 开始[9]下载from:172707813 to:191897569
    2021/03/22 20:51:34 开始[7]下载from:134328299 to:153518055
    2021/03/22 20:51:34 开始[8]下载from:153518056 to:172707812
    2021/03/22 20:51:34 开始[12]下载from:230277084 to:249466840
    2021/03/22 20:51:34 开始[10]下载from:191897570 to:211087326
    2021/03/22 20:51:34 开始[18]下载from:345415626 to:364605382
    2021/03/22 20:51:34 开始[16]下载from:307036112 to:326225868
    2021/03/22 20:51:34 开始[17]下载from:326225869 to:345415625
    2021/03/22 20:51:34 开始[40]下载from:767590280 to:786780036
    2021/03/22 20:51:34 开始[19]下载from:364605383 to:383795139
    2021/03/22 20:51:34 开始[20]下载from:383795140 to:402984896
    2021/03/22 20:51:34 开始[21]下载from:402984897 to:422174653
    2021/03/22 20:51:34 开始[22]下载from:422174654 to:441364410
    2021/03/22 20:51:34 开始[23]下载from:441364411 to:460554167
    2021/03/22 20:51:34 开始[24]下载from:460554168 to:479743924
    2021/03/22 20:51:34 开始[25]下载from:479743925 to:498933681
    2021/03/22 20:51:34 开始[26]下载from:498933682 to:518123438
    2021/03/22 20:51:34 开始[27]下载from:518123439 to:537313195
    2021/03/22 20:51:34 开始[28]下载from:537313196 to:556502952
    2021/03/22 20:51:34 开始[29]下载from:556502953 to:575692709
    2021/03/22 20:51:34 开始[30]下载from:575692710 to:594882466
    2021/03/22 20:51:34 开始[31]下载from:594882467 to:614072223
    2021/03/22 20:51:34 开始[32]下载from:614072224 to:633261980
    2021/03/22 20:51:34 开始[33]下载from:633261981 to:652451737
    2021/03/22 20:51:34 开始[34]下载from:652451738 to:671641494
    2021/03/22 20:51:34 开始[35]下载from:671641495 to:690831251
    2021/03/22 20:51:34 开始[36]下载from:690831252 to:710021008
    2021/03/22 20:51:34 开始[37]下载from:710021009 to:729210765
    2021/03/22 20:51:34 开始[38]下载from:729210766 to:748400522
    2021/03/22 20:51:34 开始[39]下载from:748400523 to:767590279
    2021/03/22 20:51:34 开始[2]下载from:38379514 to:57569270
    2021/03/22 20:51:34 开始[56]下载from:1074626392 to:1093816148
    2021/03/22 20:51:34 开始[49]下载from:940298093 to:959487849
    2021/03/22 20:51:34 开始[50]下载from:959487850 to:978677606
    2021/03/22 20:51:34 开始[48]下载from:921108336 to:940298092
    2021/03/22 20:51:34 开始[51]下载from:978677607 to:997867363
    2021/03/22 20:51:34 开始[52]下载from:997867364 to:1017057120
    2021/03/22 20:51:34 开始[41]下载from:786780037 to:805969793
    2021/03/22 20:51:34 开始[53]下载from:1017057121 to:1036246877
    2021/03/22 20:51:34 开始[42]下载from:805969794 to:825159550
    2021/03/22 20:51:34 开始[54]下载from:1036246878 to:1055436634
    2021/03/22 20:51:34 开始[55]下载from:1055436635 to:1074626391
    2021/03/22 20:51:34 开始[43]下载from:825159551 to:844349307
    2021/03/22 20:51:34 开始[46]下载from:882728822 to:901918578
    2021/03/22 20:51:34 开始[44]下载from:844349308 to:863539064
    2021/03/22 20:51:34 开始[47]下载from:901918579 to:921108335
    2021/03/22 20:51:34 开始[68]下载from:1304903476 to:1324093232
    2021/03/22 20:51:34 开始[45]下载from:863539065 to:882728821
    2021/03/22 20:51:34 开始[57]下载from:1093816149 to:1113005905
    2021/03/22 20:51:34 开始[74]下载from:1420042018 to:1439231774
    2021/03/22 20:51:34 开始[69]下载from:1324093233 to:1343282989
    2021/03/22 20:51:34 开始[58]下载from:1113005906 to:1132195662
    2021/03/22 20:51:34 开始[70]下载from:1343282990 to:1362472746
    2021/03/22 20:51:34 开始[71]下载from:1362472747 to:1381662503
    2021/03/22 20:51:34 开始[59]下载from:1132195663 to:1151385419
    2021/03/22 20:51:34 开始[72]下载from:1381662504 to:1400852260
    2021/03/22 20:51:34 开始[73]下载from:1400852261 to:1420042017
    2021/03/22 20:51:34 开始[60]下载from:1151385420 to:1170575176
    2021/03/22 20:51:34 开始[64]下载from:1228144448 to:1247334204
    2021/03/22 20:51:34 开始[61]下载from:1170575177 to:1189764933
    2021/03/22 20:51:34 开始[62]下载from:1189764934 to:1208954690
    2021/03/22 20:51:34 开始[65]下载from:1247334205 to:1266523961
    2021/03/22 20:51:34 开始[66]下载from:1266523962 to:1285713718
    2021/03/22 20:51:34 开始[63]下载from:1208954691 to:1228144447
    2021/03/22 20:51:34 开始[13]下载from:249466841 to:268656597
    2021/03/22 20:51:34 开始[67]下载from:1285713719 to:1304903475
    2021/03/22 20:51:34 开始[79]下载from:1515990803 to:1535180559
    2021/03/22 20:51:34 开始[82]下载from:1573560074 to:1592749830
    2021/03/22 20:51:34 开始[83]下载from:1592749831 to:1611939587
    2021/03/22 20:51:34 开始[80]下载from:1535180560 to:1554370316
    2021/03/22 20:51:34 开始[75]下载from:1439231775 to:1458421531
    2021/03/22 20:51:34 开始[81]下载from:1554370317 to:1573560073
    2021/03/22 20:51:34 开始[76]下载from:1458421532 to:1477611288
    2021/03/22 20:51:34 开始[85]下载from:1631129345 to:1650319101
    2021/03/22 20:51:34 开始[84]下载from:1611939588 to:1631129344
    2021/03/22 20:51:34 开始[77]下载from:1477611289 to:1496801045
    2021/03/22 20:51:34 开始[87]下载from:1669508859 to:1688698615
    2021/03/22 20:51:34 开始[78]下载from:1496801046 to:1515990802
    2021/03/22 20:51:34 开始[86]下载from:1650319102 to:1669508858
    2021/03/22 20:51:34 开始[89]下载from:1707888373 to:1727078129
    2021/03/22 20:51:34 开始[88]下载from:1688698616 to:1707888372
    2021/03/22 20:51:34 开始[90]下载from:1727078130 to:1746267886
    2021/03/22 20:51:34 开始[91]下载from:1746267887 to:1765457643
    2021/03/22 20:51:34 开始[92]下载from:1765457644 to:1784647400
    2021/03/22 20:51:34 开始[93]下载from:1784647401 to:1803837157
    2021/03/22 20:51:34 开始[94]下载from:1803837158 to:1823026914
    2021/03/22 20:51:34 开始[95]下载from:1823026915 to:1842216671
    2021/03/22 20:51:34 开始[96]下载from:1842216672 to:1861406428
    2021/03/22 20:51:34 开始[97]下载from:1861406429 to:1880596185
    2021/03/22 20:51:34 开始[99]下载from:1899785943 to:1918975642
    2021/03/22 20:51:34 开始[98]下载from:1880596186 to:1899785942
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {24 460554168 479743924 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {4 76759028 95948784 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {42 805969794 825159550 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {39 748400523 767590279 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {5 95948785 115138541 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {52 997867364 1017057120 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {34 652451738 671641494 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {17 326225869 345415625 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {0 0 19189756 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {28 537313196 556502952 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {31 594882467 614072223 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {50 959487850 978677606 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {12 230277084 249466840 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {7 134328299 153518055 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {6 115138542 134328298 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {49 940298093 959487849 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {15 287846355 307036111 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {30 575692710 594882466 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {37 710021009 729210765 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {20 383795140 402984896 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {53 1017057121 1036246877 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {19 364605383 383795139 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {54 1036246878 1055436634 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {74 1420042018 1439231774 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {45 863539065 882728821 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {44 844349308 863539064 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {40 767590280 786780036 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {55 1055436635 1074626391 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {38 729210766 748400522 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {57 1093816149 1113005905 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {36 690831252 710021008 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {33 633261981 652451737 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {2 38379514 57569270 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {27 518123439 537313195 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {41 786780037 805969793 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {47 901918579 921108335 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {11 211087327 230277083 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {35 671641495 690831251 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {46 882728822 901918578 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {16 307036112 326225868 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {3 57569271 76759027 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {68 1304903476 1324093232 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {48 921108336 940298092 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {18 345415626 364605382 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {1 19189757 38379513 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {43 825159551 844349307 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {51 978677607 997867363 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {69 1324093233 1343282989 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {25 479743925 498933681 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {58 1113005906 1132195662 [] }
    2021/03/22 20:51:35 下载文件失败: 服务器错误状态码: 403 {70 1343282990 1362472746 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {65 1247334205 1266523961 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {81 1554370317 1573560073 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {61 1170575177 1189764933 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {79 1515990803 1535180559 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {73 1400852261 1420042017 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {85 1631129345 1650319101 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {62 1189764934 1208954690 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {59 1132195663 1151385419 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {80 1535180560 1554370316 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {72 1381662504 1400852260 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {67 1285713719 1304903475 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {60 1151385420 1170575176 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {63 1208954691 1228144447 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {64 1228144448 1247334204 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {71 1362472747 1381662503 [] }
    2021/03/22 20:51:36 下载文件失败: 服务器错误状态码: 403 {66 1266523962 1285713718 [] }
    2021/03/22 20:51:37 结束[56]下载from:1074626392 to:1093816148
    2021/03/22 20:51:37 结束[10]下载from:191897570 to:211087326
    2021/03/22 20:51:37 结束[29]下载from:556502953 to:575692709
    2021/03/22 20:51:37 结束[14]下载from:268656598 to:287846354
    2021/03/22 20:51:37 结束[8]下载from:153518056 to:172707812
    2021/03/22 20:51:38 结束[21]下载from:402984897 to:422174653
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {95 1823026915 1842216671 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {84 1611939588 1631129344 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {75 1439231775 1458421531 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {86 1650319102 1669508858 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {94 1803837158 1823026914 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {89 1707888373 1727078129 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {87 1669508859 1688698615 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {96 1842216672 1861406428 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {13 249466841 268656597 [] }
    2021/03/22 20:51:38 结束[22]下载from:422174654 to:441364410
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {77 1477611289 1496801045 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {98 1880596186 1899785942 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {90 1727078130 1746267886 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {82 1573560074 1592749830 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {97 1861406429 1880596185 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {99 1899785943 1918975642 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {92 1765457644 1784647400 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {78 1496801046 1515990802 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {91 1746267887 1765457643 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {93 1784647401 1803837157 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {88 1688698616 1707888372 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {76 1458421532 1477611288 [] }
    2021/03/22 20:51:38 下载文件失败: 服务器错误状态码: 403 {83 1592749831 1611939587 [] }
    2021/03/22 20:51:39 结束[23]下载from:441364411 to:460554167
    2021/03/22 20:51:39 结束[9]下载from:172707813 to:191897569
    2021/03/22 20:51:40 结束[26]下载from:498933682 to:518123438
    2021/03/22 20:51:41 结束[32]下载from:614072224 to:633261980
    2021/03/22 20:51:41 下载文件失败
    2021/03/22 20:51:41 download failed, err: downloadPart failed
    1.fileDownloader.Download failed, err: downloadPart failed
    
    opened by AngryBigCat 2
  • error_msg

    error_msg":"app id is empty"

    代码: path := "/apps/go/Doc5.docx" localFilePath := "/Users/cody/Downloads/Doc5.docx" fileUploader := file.NewUploader(accessToken, path, localFilePath) resp, err2 := fileUploader.Upload() 报错: response[{"error_code":31024,"error_msg":"app id is empty","request_id"

    opened by codyace 1
  • 遇到大文件时经常报错 downloadPart failed (unexpected)

    遇到大文件时经常报错 downloadPart failed (unexpected)

    想问一下,是不是被服务端限制了或禁止了? 是不是要开通VIP才能有更好的下载体验? 前面10个分片都能正常下载,从第11个分片开始就出错了。

    /jsyzchen/[email protected]/utils/file/download.go:64: isSupportRange: true /jsyzchen/[email protected]/utils/file/download.go:76: downloadPart /jsyzchen/[email protected]/utils/file/download.go:86: TotalPart: 19 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[9]下载from:92318598 to:102576219 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[4]下载from:41030488 to:51288109 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[6]下载from:61545732 to:71803353 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[7]下载from:71803354 to:82060975 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[8]下载from:82060976 to:92318597 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[1]下载from:10257622 to:20515243 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[0]下载from:0 to:10257621 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[5]下载from:51288110 to:61545731 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[2]下载from:20515244 to:30772865 /jsyzchen/[email protected]/utils/file/download.go:170: 开始[3]下载from:30772866 to:41030487 /jsyzchen/[email protected]/utils/file/download.go:120: 下载文件失败: unexpected EOF {7 71803354 82060975 [] } /jsyzchen/[email protected]/utils/file/download.go:170: 开始[10]下载from:102576220 to:112833841 /jsyzchen/[email protected]/utils/file/download.go:120: 下载文件失败: unexpected EOF {8 82060976 92318597 [] } /jsyzchen/[email protected]/utils/file/download.go:170: 开始[11]下载from:112833842 to:123091463 /jsyzchen/[email protected]/utils/file/download.go:120: 下载文件失败: unexpected EOF {5 51288110 61545731 [] }

    opened by spzgy 1
  • [optimize] 分片上传建议限制 goroutine 数量,上传大文件时会占用大量内存

    [optimize] 分片上传建议限制 goroutine 数量,上传大文件时会占用大量内存

    	file, err := os.Open(u.LocalFilePath)
    	if err != nil {
    		return ret, err
    	}
    	defer file.Close()
    	uploadRespChan := make(chan SuperFile2UploadResponse)
    	for i := 0; i < sliceNum; i++ {
    		buffer := make([]byte, sliceSize)
    		n, err := file.Read(buffer[:])
    		if err != nil && err != io.EOF {
    			log.Println("file.Read failed, err:", err)
    			return ret, err
    		}
    		if n == 0 {
    			break
    		}
                    // 如果分片数量过多,这里会开大量 goroutine 进行上传,导致瞬间占用内存巨大
    		go func(partSeq int, partByte []byte) {
    			uploadResp, err := u.SuperFile2Upload(uploadID, partSeq, partByte)
    			uploadRespChan <- uploadResp
    			if err != nil {
    				log.Printf("SuperFile2UploadFailed, partseq[%d] err[%v]", partSeq, err)
    			}
    		}(i, buffer[0:n])
    	}
    

    image

    opened by LinkinStars 1
  • 这是什么个情况?Poms key is not existing in DDBS

    这是什么个情况?Poms key is not existing in DDBS

    2022/06/25 17:22:12 2022/06/25 17:21:41 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[{"error_code":31297, "error_msg":"Poms key is not existing in DDBS"}] 2022/06/25 17:22:12 2022/06/25 17:21:41 SuperFile2UploadFailed, partseq[3] err[error_code:31297, error_msg:Poms key is not existing in DDBS] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[0] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[1] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[4] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[2] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[8] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[9] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 upload failed, path[/csdnRes/cs2.zzlzy.love.zip] response[] 2022/06/25 17:22:12 2022/06/25 17:22:12 SuperFile2UploadFailed, partseq[5] err[unexpected end of JSON input] 2022/06/25 17:22:12 2022/06/25 17:22:12 superfile2 upload part failed

    opened by EliseCaro 4
Releases(v1.0.1)
Owner
Jsyz Chen
Developer
Jsyz Chen
🐥 Sturdy is an open-source, real-time, version control platform for startups

Welcome to Sturdy! ?? ?? Real-time code collaboration. Sturdy is an open-source version control platform that allows you to interact with your code at

Sturdy 428 Sep 26, 2022
SDK to provide access to JUNO API (Open Banking) (2.0.0)

Juno API - Golang SDK Juno API (Open Banking) (2.0.0) Why? This project is part of my personal portfolio, so, I'll be happy if you could provide me an

Vinícius Boscardin 4 Aug 9, 2021
Unofficial SDK to access for Open Threat Exchange (OTX) in Go

gotx Unofficial SDK to access for Open Threat Exchange (OTX) API in Go. Usage package main import ( "context" "fmt" "os" "github.com/m-mizutani/

Masayoshi Mizutani 0 Feb 12, 2022
Unofficial Golang SDK for TON (The Open Network)

TonWeb Unofficial Golang SDK for TON (The Open Network) Installation go get github.com/neotoolkit/tonweb Usage package main import ( "fmt" "os" "

null 4 Jun 13, 2022
Go SDK for working with the Nightfall Developer Platform

Nightfall Go SDK nightfall-go-sdk is a Go client library for accessing the Nightfall API. It allows you to add functionality to your applications to s

Nightfall AI 10 Jun 20, 2022
Nextengine-sdk-go: the NextEngine SDK for the Go programming language

NextEngine SDK for Go nextengine-sdk-go is the NextEngine SDK for the Go programming language. Getting Started Install go get github.com/takaaki-s/nex

null 0 Dec 7, 2021
Commercetools-go-sdk is fork of original commercetools-go-sdk

commercetools-go-sdk The Commercetools Go SDK is automatically generated based on the official API specifications of Commercetools. It should therefor

Flink 0 Dec 13, 2021
Sdk-go - Go version of the Synapse SDK

synapsesdk-go Synapse Protocol's Go SDK. Currently in super duper alpha, do not

null 0 Jan 7, 2022
Redash-go-sdk - An SDK for the programmatic management of Redash, in Go

Redash Go SDK An SDK for the programmatic management of Redash. The main compone

RecoLabs 26 Sep 9, 2022
Go(lang) client library for Cachet (open source status page system).

cachet Go(lang) client library for Cachet (open source status page system). Features Full API support Components Incidents Metrics Subscribers Various

Andy Grunwald 90 Jan 28, 2022
Sync your bank transactions with google sheets using Open Banking APIs

Sync your bank transactions with google sheets using Open Banking APIs

Alex Russell-Saw 30 Jul 22, 2022
Sync your bank transactions with google sheets using Open Banking APIs

this is a markdown version of the copy on the site landing page: https://youneedaspreadsheet.com You need a spreadsheet ?? Get on top of your finances

Alex Russell-Saw 30 Jul 22, 2022
Open Cluster Management API

Open Cluster Management API Community, discussion, contribution, and support Getting Started Prerequisites Security Response The api repository define

Open Cluster Management 204 Sep 9, 2022
Go API Client for NASA's Open APIs

Go Client for Nasa Open APIs Description The Go Client for Nasa Open APIs is a Go Client for the following Nasa Open APIs: APOD: Astronomy Picture of

Ernesto H 3 Sep 24, 2021
Simple Go client for open-meteo.com

Open-Meteo-Go A simple go client for the open meteo API. It supports all options of the API as of Sept 20 2021. Usage Simple example: package main im

Dennis 6 Sep 20, 2022
DiscSpam is the best free and open source tool to spam/raid Discord servers.

DiscSpam Fast, Free, Easy to use Discord.com raid tool Report Bug , Request Feature About The Project There are a few Discord raid tools on GitHub, ho

null 47 Sep 22, 2022
This is the new api repository for Feel the Movies. Written in Go, totally open source.

This is the new API repository for Feel the Movies. Written in Go, totally open source. App Currently available for Android only. I have plans for an

Cyro Dubeux 35 Sep 18, 2022
🚀 A command with fzf-like UI to quickly search Wikipedia articles and open it in your browser

fzwiki A command with fzf-like UI to quickly search Wikipedia articles and open it in your browser. Usage Run the command by specifying a search query

sheepla 76 Sep 5, 2022
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Siva Prakash 3 Feb 6, 2022