mirror of
https://gitee.com/sjqzhang/go-fastdfs.git
synced 2024-11-30 02:07:45 +08:00
736 lines
21 KiB
HTML
736 lines
21 KiB
HTML
|
||
<!DOCTYPE HTML>
|
||
<html lang="" >
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||
<title>断点续传"SDK" · GitBook</title>
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<meta name="description" content="">
|
||
<meta name="generator" content="GitBook 3.2.3">
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="gitbook/style.css">
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta name="HandheldFriendly" content="true"/>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
|
||
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
|
||
|
||
|
||
<link rel="next" href="breakpoint.html" />
|
||
|
||
|
||
<link rel="prev" href="usage.html" />
|
||
|
||
|
||
</head>
|
||
<body>
|
||
|
||
<div class="book">
|
||
<div class="book-summary">
|
||
|
||
|
||
<div id="book-search-input" role="search">
|
||
<input type="text" placeholder="Type to search" />
|
||
</div>
|
||
|
||
|
||
<nav role="navigation">
|
||
|
||
|
||
|
||
<ul class="summary">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<li class="chapter " data-level="1.1" data-path="./">
|
||
|
||
<a href="./#vision">
|
||
|
||
|
||
愿景
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.2" data-path="./">
|
||
|
||
<a href="./#background">
|
||
|
||
|
||
背景
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.2.1" data-path="./">
|
||
|
||
<a href="./#what">
|
||
|
||
|
||
go-fastdfs是什么?
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.3" data-path="./">
|
||
|
||
<a href="./#character">
|
||
|
||
|
||
特性
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.3.1" data-path="./">
|
||
|
||
<a href="./#advantage">
|
||
|
||
|
||
go-fastdfs优点
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.4" data-path="install.html">
|
||
|
||
<a href="install.html">
|
||
|
||
|
||
安装
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.4.1" data-path="install.html">
|
||
|
||
<a href="install.html#quick">
|
||
|
||
|
||
极速体验
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.4.2" data-path="install.html">
|
||
|
||
<a href="install.html#docker">
|
||
|
||
|
||
Docker体验
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.4.3" data-path="install.html">
|
||
|
||
<a href="install.html#compiler_install">
|
||
|
||
|
||
编译安装
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.4.4" data-path="install.html">
|
||
|
||
<a href="install.html#small-cluster">
|
||
|
||
|
||
小集群安装
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.4.5" data-path="install.html">
|
||
|
||
<a href="install.html#big-cluster">
|
||
|
||
|
||
海量集群安装(推荐)
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.5" data-path="authentication.html">
|
||
|
||
<a href="authentication.html">
|
||
|
||
|
||
认证
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.5.1" data-path="authentication.html">
|
||
|
||
<a href="authentication.html#fingerprint">
|
||
|
||
|
||
按文件指纹认证
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.5.2" data-path="authentication.html">
|
||
|
||
<a href="authentication.html#google">
|
||
|
||
|
||
按google认证码认证
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.5.3" data-path="authentication.html">
|
||
|
||
<a href="authentication.html#custom">
|
||
|
||
|
||
用户自定义认证
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6" data-path="usage.html">
|
||
|
||
<a href="usage.html">
|
||
|
||
|
||
语言"SDK"
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.6.1" data-path="usage.html">
|
||
|
||
<a href="usage.html#description">
|
||
|
||
|
||
统一说明(重要)
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6.2" data-path="usage.html">
|
||
|
||
<a href="usage.html#cmdline">
|
||
|
||
|
||
命令行上传
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6.3" data-path="usage.html">
|
||
|
||
<a href="usage.html#web">
|
||
|
||
|
||
浏览器上传
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6.4" data-path="usage.html">
|
||
|
||
<a href="usage.html#python">
|
||
|
||
|
||
Python语言
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6.5" data-path="usage.html">
|
||
|
||
<a href="usage.html#go">
|
||
|
||
|
||
GO使用
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.6.6" data-path="usage.html">
|
||
|
||
<a href="usage.html#java">
|
||
|
||
|
||
Java语言
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.6.6.1" data-path="usage.html">
|
||
|
||
<a href="usage.html#java-stream">
|
||
|
||
|
||
Java流上传
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.7" data-path="breakpoint.html">
|
||
|
||
<a href="breakpoint.html#go">
|
||
|
||
|
||
断点续传"SDK"
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.7.1" data-path="breakpoint.html">
|
||
|
||
<a href="breakpoint.html#go">
|
||
|
||
|
||
GO
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.7.2" data-path="breakpoint.html">
|
||
|
||
<a href="breakpoint.html#js">
|
||
|
||
|
||
Javascript
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.8" data-path="api.html">
|
||
|
||
<a href="api.html">
|
||
|
||
|
||
管理API
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.9" data-path="QA.html">
|
||
|
||
<a href="QA.html">
|
||
|
||
|
||
问题汇总
|
||
|
||
</a>
|
||
|
||
|
||
|
||
<ul class="articles">
|
||
|
||
|
||
<li class="chapter " data-level="1.9.1" data-path="QA.html">
|
||
|
||
<a href="QA.html">
|
||
|
||
|
||
常见问题
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.9.2" data-path="QA.html">
|
||
|
||
<a href="QA.html">
|
||
|
||
|
||
维护问题
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
</li>
|
||
|
||
<li class="chapter " data-level="1.10" data-path="upgrade.html">
|
||
|
||
<a href="upgrade.html">
|
||
|
||
|
||
更新历史
|
||
|
||
</a>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li class="divider"></li>
|
||
|
||
<li>
|
||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||
Published with GitBook
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
|
||
|
||
</nav>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="book-body">
|
||
|
||
<div class="body-inner">
|
||
|
||
|
||
|
||
<div class="book-header" role="navigation">
|
||
|
||
|
||
<!-- Title -->
|
||
<h1>
|
||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||
<a href="." >断点续传"SDK"</a>
|
||
</h1>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="page-wrapper" tabindex="-1" role="main">
|
||
<div class="page-inner">
|
||
|
||
<div id="book-search-results">
|
||
<div class="search-noresults">
|
||
|
||
<section class="normal markdown-section">
|
||
|
||
<h1 id="断点续传示例">断点续传示例</h1>
|
||
<h2 id="go">golang版本</h2>
|
||
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main
|
||
|
||
<span class="hljs-keyword">import</span> (
|
||
<span class="hljs-string">"os"</span>
|
||
<span class="hljs-string">"fmt"</span>
|
||
<span class="hljs-string">"github.com/eventials/go-tus"</span>
|
||
)
|
||
|
||
<span class="hljs-keyword">func</span> main() {
|
||
f, err := os.Open(<span class="hljs-string">"100m"</span>)
|
||
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
|
||
<span class="hljs-built_in">panic</span>(err)
|
||
}
|
||
<span class="hljs-keyword">defer</span> f.Close()
|
||
<span class="hljs-comment">// create the tus client.</span>
|
||
client, err := tus.NewClient(<span class="hljs-string">"http://10.1.5.9:8080/big/upload/"</span>, <span class="hljs-literal">nil</span>)
|
||
fmt.Println(err)
|
||
<span class="hljs-comment">// create an upload from a file.</span>
|
||
upload, err := tus.NewUploadFromFile(f)
|
||
fmt.Println(err)
|
||
<span class="hljs-comment">// create the uploader.</span>
|
||
uploader, err := client.CreateUpload(upload)
|
||
fmt.Println(err)
|
||
<span class="hljs-comment">// start the uploading process.</span>
|
||
fmt.Println( uploader.Upload())
|
||
|
||
}
|
||
|
||
<span class="hljs-string">`
|
||
</span></code></pre>
|
||
<h2 id="js">javascript版本 <a href="https://uppy.io/" target="_blank">更多请查阅</a></h2>
|
||
<pre><code class="lang-html">
|
||
<span class="hljs-tag"><<span class="hljs-name">html</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">head</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"utf-8"</span> /></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">title</span>></span>go-fastdfs<span class="hljs-tag"></<span class="hljs-name">title</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">style</span>></span><span class="undefined">form { bargin } .form-line { display:block;height: 30px;margin:8px; } #stdUpload {background: #fafafa;border-radius: 10px;width: 745px; }</span><span class="hljs-tag"></<span class="hljs-name">style</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">link</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://transloadit.edgly.net/releases/uppy/v0.30.0/dist/uppy.min.css"</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span>></span>
|
||
<span class="hljs-tag"></<span class="hljs-name">head</span>></span>
|
||
|
||
<span class="hljs-tag"><<span class="hljs-name">body</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">div</span>></span>断点续传(如果文件很大时可以考虑)<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">div</span>></span>
|
||
|
||
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"drag-drop-area"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://transloadit.edgly.net/releases/uppy/v0.30.0/dist/uppy.min.js"</span>></span><span class="undefined"></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
|
||
<span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="actionscript"><span class="hljs-keyword">var</span> uppy = Uppy.Core().use(Uppy.Dashboard, {
|
||
inline: <span class="hljs-literal">true</span>,
|
||
target: <span class="hljs-string">'#drag-drop-area'</span>
|
||
}).use(Uppy.Tus, {
|
||
endpoint: <span class="hljs-string">'/big/upload/'</span>
|
||
})
|
||
uppy.on(<span class="hljs-string">'complete'</span>, (result) => {
|
||
<span class="hljs-comment">// console.log(result) console.log('Upload complete! We’ve uploaded these files:', result.successful)</span>
|
||
})
|
||
uppy.setMeta({ auth_token: <span class="hljs-string">'xx'</span>,callback_url:<span class="hljs-string">'http://127.0.0.1/callback'</span> })<span class="hljs-comment">//这里是传递上传的认证参数,callback_url参数中 id为文件的ID,info 文转的基本信息json</span>
|
||
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
|
||
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
||
<span class="hljs-tag"></<span class="hljs-name">body</span>></span>
|
||
<span class="hljs-tag"></<span class="hljs-name">html</span>></span>
|
||
</code></pre>
|
||
<p><a href="https://github.com/tus" target="_blank">更多客户端请参考</a></p>
|
||
|
||
|
||
</section>
|
||
|
||
</div>
|
||
<div class="search-results">
|
||
<div class="has-results">
|
||
|
||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||
<ul class="search-results-list"></ul>
|
||
|
||
</div>
|
||
<div class="no-results">
|
||
|
||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<a href="usage.html#java-stream" class="navigation navigation-prev " aria-label="Previous page: Java流上传">
|
||
<i class="fa fa-angle-left"></i>
|
||
</a>
|
||
|
||
|
||
<a href="breakpoint.html#go" class="navigation navigation-next " aria-label="Next page: GO">
|
||
<i class="fa fa-angle-right"></i>
|
||
</a>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<script>
|
||
var gitbook = gitbook || [];
|
||
gitbook.push(function() {
|
||
gitbook.page.hasChanged({"page":{"title":"断点续传\"SDK\"","level":"1.7","depth":1,"next":{"title":"GO","level":"1.7.1","depth":2,"anchor":"#go","path":"breakpoint.md","ref":"breakpoint.md#go","articles":[]},"previous":{"title":"Java流上传","level":"1.6.6.1","depth":3,"anchor":"#java-stream","path":"usage.md","ref":"usage.md#java-stream","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"breakpoint.md","mtime":"2019-08-29T03:43:35.178Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-11-28T06:39:40.626Z"},"basePath":".","book":{"language":""}});
|
||
});
|
||
</script>
|
||
</div>
|
||
|
||
|
||
<script src="gitbook/gitbook.js"></script>
|
||
<script src="gitbook/theme.js"></script>
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-search/search.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||
|
||
|
||
|
||
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||
|
||
|
||
|
||
</body>
|
||
</html>
|
||
|