Fastdfs. NET clients are currently relatively small, and most of them are not readily available with native
Recommend a more convenient
:
https://www.nuget.org/packages/NengLong.CMP.FastDFSClient/1.0.1
Using the technology is IKVM can write and native Java-like file processing, more convenient
A simple example is as follows:
Using system;using system.collections.generic;using system.linq;using system.text;using org.csource.fastdfs;using System.io;namespace consoleapplication2{class Program {static void Main (string[] args) { Clientglobal.init ("client.conf"); Initial Configuration load tracker information, can refer to Javaapi trackerclient trackerclient; Trackerserver Trackerserver; StorageClient1 storageclient; Storageserver Storageserver; Trackerclient = new Trackerclient (); Trackerserver = Trackerclient.getconnection (); Storageserver = Trackerclient.getstorestorage (trackerserver); Storageclient = new StorageClient1 (Trackerserver, storageserver); The storage operation class generates FileStream FS = new FileStream ("client.conf", FileMode.OpenOrCreate, FileAccess.Read); byte[] buffer = new BYTE[FS. Length]; Fs. Read (buffer, 0, buffer. Length); Fs. Close (); var FileInfo = Storageclient.upload_file1 ("DD.xlsx "," xlsx ", null); Upload file Console.WriteLine (FileInfo); var data= storageclient.download_file1 (FileInfo); Download file var dat2 = storageclient.download_file1 ("Group1/m00/00/00/zcijufcwnpqats68aab4ahkdiva163.tar"); Download the existing file FileStream FS2 = new FileStream ("Dddd.xlsx", FileMode.OpenOrCreate); BinaryWriter bw = new BinaryWriter (FS2); Bw. Write (data); Bw. Close (); FS2. Close (); FileStream FS3 = new FileStream ("Demo.tar", FileMode.OpenOrCreate); BinaryWriter bw2 = new BinaryWriter (FS3); Bw2. Write (DAT2); Fs3. Close (); FS2. Close (); Console.ReadLine (); } }}
Fastdfs. NET Client