Git Product home page Git Product logo

go-client-for-fastdfs's Introduction

go-client-for-fastdfs

#简介: go-client-for-fastdfs是实现了使用go语言来调用fastdfs的接口,本质就是用fastdfs 的c api写成相关的c功能函数并输出为 .so文件,go语言调用.so文件来调用c功能函数 现在只实现了两个接口:

//上传文件到fdfs

func FdfsUploadFile(conf string,imagePath string)(result map[string]interface{},err error)

//删除fdfs文件

func FdfsDeleteFile(conf string,fileId string)(result map[string]interface{},err error)

#使用方法(fastdfs是基于4.0.6版本):

1、进入目录 go-client-for-fastdfs

2、编译成动态链接库:gcc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O -DDEBUG_FLAG -DOS_LINUX -DIOEVENT_USE_EPOLL -fPIC -shared -o libfdfs.so fdfs.c -L/usr/local/lib -lfastcommon -lfdfsclient -lpthread -ldl -rdynamic -I/usr/local/include/fastcommon -I/usr/local/include/fastdfs

3、把生成的文件复制到libfdfs.so 复制到/usr/local/lib ,注意文件的权限

4、查看/etc/ld.so.conf,看一下路径/usr/local/lib是否存在,没有就添加进去,最后ldconfig更新路径

cat /etc/ld.so.conf echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig

5、实例代码请查看test.go

注意,在使用go语言调用c函数的时候,本人踩过的一个超坑人的坑,详细请看:http://www.newjueqi.com/?p=106

go-client-for-fastdfs's People

Contributors

newjueqi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.