All Projects → poemp → large-file-upload-fastDfs

poemp / large-file-upload-fastDfs

Licence: other
大文件分块上传到fastDfs

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to large-file-upload-fastDfs

Spring Boot Examples
about learning Spring Boot via examples. Spring Boot 教程、技术栈示例代码,快速简单上手教程。
Stars: ✭ 26,812 (+141015.79%)
Mutual labels:  fastdfs
Dailyfresh
Django-天天生鲜电商学习项目
Stars: ✭ 127 (+568.42%)
Mutual labels:  fastdfs
Dailyfresh B2c
dailyfresh mall based on B2C model
Stars: ✭ 177 (+831.58%)
Mutual labels:  fastdfs
Linux Tutorial
《Java 程序员眼中的 Linux》
Stars: ✭ 7,757 (+40726.32%)
Mutual labels:  fastdfs
Superman
Superman是什么:构建Java 高级开发技术的知识体系,从基础不断打怪升级成为超人之路(更新中.......)
Stars: ✭ 106 (+457.89%)
Mutual labels:  fastdfs
E3 Springboot
SpringBoot+Docker重构宜立方商城
Stars: ✭ 139 (+631.58%)
Mutual labels:  fastdfs
Uexam
学之思在线考试系统,支持多种题型:选择题、多选题、判断题、填空题、解答题以及数学公式,包含PC端、小程序端,扩展性强,部署方便、界面设计友好、代码结构清晰
Stars: ✭ 473 (+2389.47%)
Mutual labels:  fastdfs
Go Fastdfs
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic r…
Stars: ✭ 2,923 (+15284.21%)
Mutual labels:  fastdfs
Gis
gis (go image server) go 实现的图片服务,实现基本的上传,下载,存储,按比例裁剪等功能
Stars: ✭ 108 (+468.42%)
Mutual labels:  fastdfs
Spring Examples
Spring Examples
Stars: ✭ 172 (+805.26%)
Mutual labels:  fastdfs
Fdfs client
fastdfs go client impl
Stars: ✭ 52 (+173.68%)
Mutual labels:  fastdfs
Spring Boot 2.x Examples
Spring Boot 2.x code examples
Stars: ✭ 104 (+447.37%)
Mutual labels:  fastdfs
Nginx Lua Graphicsmagick
类似淘宝图片,用Lua脚本实现的自定义图片尺寸,动态生成缩略图
Stars: ✭ 153 (+705.26%)
Mutual labels:  fastdfs
Libfastcommon
c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist, object pool etc. detail info please see the c header files.
Stars: ✭ 739 (+3789.47%)
Mutual labels:  fastdfs
Xbin Store
模仿国内知名B2C网站,实现的一个分布式B2C商城 使用Spring Boot 自动配置 Dubbox / MVC / MyBatis / Druid / Solr / Redis 等。使用Spring Cloud版本请查看
Stars: ✭ 2,140 (+11163.16%)
Mutual labels:  fastdfs
Jeesuite Libs
分布式架构开发套件。包括缓存(一二级缓存、自动缓存管理)、队列、分布式定时任务、文件服务(七牛、阿里云OSS、fastDFS)、日志、搜索、分布式锁、分布式事务、集成dubbo、spring boot支持以及常用的工具包等。
Stars: ✭ 584 (+2973.68%)
Mutual labels:  fastdfs
Nice Knowledge System
📚不积跬步无以至千里,每天进步一点点,Passion,Self-regulation,Love and Share
Stars: ✭ 137 (+621.05%)
Mutual labels:  fastdfs
uccn
一个简洁的官网
Stars: ✭ 62 (+226.32%)
Mutual labels:  fastdfs
Fdfs client
fastdfs go client compatible with ver 4.0.6
Stars: ✭ 205 (+978.95%)
Mutual labels:  fastdfs
Ruoyi Cloud
(RuoYi)官方仓库 基于Spring Boot、Spring Cloud & Alibaba的分布式微服务架构权限管理系统
Stars: ✭ 160 (+742.11%)
Mutual labels:  fastdfs

large-file-upload-fastDfs

实现大文件的断点续传,使用Redis做数据信息的缓存,不提供数据的删除。

代码更新下来,启动。

1、 创建并且指定ClientId,(可以指定或者不指定)

   CookieStore cookieStore = new BasicCookieStore();
   BasicClientCookie basicClientCookie = new BasicClientCookie("clientId",clinetId);
   basicClientCookie.setDomain(url);
   cookieStore.addCookie(basicClientCookie);

2、 获取文件的分块大小信息,之前上传文件的信息

    http://127.0.0.1:8082/fs/largeUploader/getConfig

返回的格式是(刚开始上传返回请求该接口返回的数据):

{
    "inByte":10485760,
    "largeFileUploadResultMap":{}
    }
}

3、准备上传的信息,后端会生成相应的数据

    http://127.0.0.1:8082/fs/largeUploader/prepareUpload
  • 需要组装响应的元数据

    tempId 文件编号

    fileName 文件名

    size 文件的大小

    crc 文件验证码

  • 组装成Json

{
    "tempId":{
        "tempId":0,
        "fileName":"text.file",
        "size":123,
        "crc":""
    }
}
  • 返回数据格式
{
   "0":"f75c64b3-200e-4c51-8ec1-4a483fd7819b"
}

4、开始上传(post)

    http://127.0.0.1:8082/fs/fs/largeUploader/asyncFileUploader
  • 需要组装响应的元数据

    fileId 文件id

    crc 文件验证

  • 指定文件块的开始位置和结束位置

      当前值是放在请求的 header 之中

   eg: request.setHeader("Origin-Rang", fileEntity.getFileOffset() + "-" + fileEntity.getFileEnd() + "-" + fileEntity.getPartNumber());

5、获取文件的分块大小信息,之前上传文件的信息

    http://127.0.0.1:8082/fs/largeUploader/getConfig

返回的格式是(刚开始上传返回请求该接口返回的数据):

{
  "inByte":10485760,
  "largeFileUploadResultMap":{
      "f75c64b3-200e-4c51-8ec1-4a483fd7819b":{
          "originalFileName":"R0011368.docx",
          "originalFileSizeInBytes":25555,
          "crcedBytes":10485760,
          "firstChunkCrc":"230546538",
          "status":true,
          "fileId":"f75c64b3-200e-4c51-8ec1-4a483fd7819b",
          "fileComplete":true,
          "error":false,
          "uploadFileId":"M00/08/68/CgYWNVp1aXOEYfNuAAAAAOoEwUg61.docx",
          "groupName":"group1",
          "originalFileSize":0,
          "largeFileUploadChunkResultMap":{
              "da47b1ab@0":{
                  "fileOffset":0,
                  "fileEnd":25555,
                  "partNumber":0,
                  "fileCheckNum":"da47b1ab",
                  "length":25555,
                  "status":true,
                  "error":false
              }
          }
      }
  }
}

在获取元数据的时候,如果文件分块没有上传完成或是报错,可以重新上传。

all

有问题请联系我[email protected]

期待相互交流

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].