패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 서버를 사용하는 프로젝트
  • 원격 파일 시스템을 통합하는 팀

고려 사항

  • 기본 웹다브 작업에 제한됨
  • 내장 캐시 또는 오프라인 지원 없음
  • 인증은 외부에서 처리해야 합니다
  • 고성능 대량 전송에 적합하지 않습니다

원본 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 개

소스 저장소

이 패키지를 사용하는 프로젝트