パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.2.2

webdav_client

いくつかの一般的なメソッドをサポートするシンプルな WebDAV クライアントです。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
2.3万
いいね数
63
Pub ポイント
130

パッケージをインストール

flutter pub add webdav_client

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterアプリケーション向けの軽量なWebDAVクライアントで、GET、PUT、POST、DELETEなどの一般的なHTTPメソッドを使用してWebDAVサーバーと対話できます。リモートサーバー上のファイルのアップロード、ダウンロード、リスト表示などのファイル管理タスクを簡単にします。クロスプラットフォーム対応で、Android、iOS、macOS、Windows、Linuxをサポートしています。複雑な設定なしにクラウドストレージ統合やリモートファイルアクセスが必要なアプリに最適です。シンプルなAPIにより、信頼性の高いWebDAV接続を求める開発者にとって使いやすいです。

用途

  • クラウドファイル同期
  • リモートファイル管理
  • ドキュメントストレージ統合
  • バックアップシステム
  • 共同文書アクセス

主な機能

  • 標準のWebDAVメソッドをサポートしています
  • クロスプラットフォーム互換性
  • シンプルで直感的な API
  • セキュアな認証処理
  • 軽量で最小限の依存関係

適している対象

  • ファイル中心のアプリを開発する開発者
  • クラウドストレージアクセスを必要とするアプリ
  • WebDAV サーバーを使用するプロジェクト
  • リモートファイルシステムを統合するチーム

注意事項

  • 基本的な WebDAV 操作に制限されています
  • 組み込みのキャッシュまたはオフラインサポートなし
  • 認証は外部で処理する必要があります
  • 高性能なバルク転送には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

webdav_client

A dart WebDAV client library(support null-safety), use dio as http client.

pub.dev link

Main features


web support

see stackoverflow for CORSB problems needing attention

web

Usage

First of all you should create client instance using newClient() function:

var client = newClient(
    'http://localhost:6688/',
    user: 'flyzero',
    password: '123456',
    debug: true,
  );
Common settings
    // Set the public request headers
    client.setHeaders({'accept-charset': 'utf-8'});

    // Set the connection server timeout time in milliseconds.
    client.setConnectTimeout(8000);

    // Set send data timeout time in milliseconds.
    client.setSendTimeout(8000);

    // Set transfer data time in milliseconds.
    client.setReceiveTimeout(8000);

    // Test whether the service can connect
    try {
      await client.ping();
    } catch (e) {
      print('$e');
    }
Read all files in a folder
    var list = await client.readDir('/');
    list.forEach((f) {
        print('${f.name} ${f.path}');
      });

    // can sub folder
    var list2 = await client.readDir('/sub/sub/folder');
    list2.forEach((f) {
        print('${f.name} ${f.path}');
      });
    
Create folder
    await client.mkdir('/新建文件夹');

    // Recursively create folders
    await client.mkdirAll('/new folder/new folder2');
Remove a folder or file

If you remove the folder, some webdav services require a '/' at the end of the path.

    // Delete folder
    await client.remove('/new folder/new folder2/');

    // Delete file
    await client.remove('/new folder/新建文本文档.txt');
Rename a folder or file

If you rename the folder, some webdav services require a '/' at the end of the path.

    // Rename folder
    await client.rename('/新建文件夹/', '/新建文件夹2/', true);

    // Rename file
    await client.rename('/新建文件夹2/test.dart', '/新建文件夹2/test2.dart', true);
Copy a file / folder from A to B

If copied the folder (A > B), it will copy all the contents of folder A to folder B.

Some webdav services have been tested and found to delete the original contents of the B folder!!!

    // Copy all the contents of folderA to folder B
    await client.copy('/folder/folderA/', '/folder/folderB/', true);

    // Copy file
    await client.copy('/folder/aa.png', '/folder/bb.png', true);
Download file
    // download bytes
    await client.read('/folder/folder/openvpn.exe', onProgress: (c, t) {
        print(c / t);
      });

    // download 2 local file with stream 
    await client.read2File(
          '/folder/vpn.exe', 'C:/Users/xxx/vpn2.exe', onProgress: (c, t) {
        print(c / t);
      });
Upload file
    // upload local file 2 remote file with stream
    CancelToken c = CancelToken();
    await client.writeFromFile(
        'C:/Users/xxx/vpn.exe', '/f/vpn2.exe', onProgress: (c, t) {
        print(c / t);
      }, cancelToken: c);
Cancel request
    CancelToken cancel = CancelToken();

    // Supports most methods
    client.mkdir('/新建文件夹', cancel)
    .catchError((err) {
      prints(err.toString());
    });

    // in other
    cancel.cancel('reason')

カテゴリー

依存関係

依存関係一覧 3 件

ソースリポジトリ

このパッケージを使用しているプロジェクト