当前位置: 首页 > web >正文

纯血鸿蒙下的webdav库

目前单框架原生鸿蒙下的协议传输库适配较少,需要等待后续发力。

目前已知的第三方库:

@dove/webdav(V0.2.1) 

仓库地址:ohos_napi · AtomGit_开放原子开源基金会代码托管平台

已经测试可用的功能:

直通车: atomgit.com/wysp2012/ohos_napi/blob/master/har/entry/src/main/ets/pages/Index.ets

import { AuthType, Client } from '@dove/webdav';@Entry
@Component
struct Index {@State message: string = 'Hello World';build() {Column() {Text(this.message).maxLines(6).fontSize('20vp').fontWeight(FontWeight.Bold).textOverflow({ overflow: TextOverflow.Ellipsis })Button('TEST WebDav').margin({ top: '12vp' }).onClick(async () => {try {const client = new Client("https://dav.jianguoyun.com/dav/", "michael1995415@petalmail.com", 'agxc36j3uxn56iqh', AuthType.Basic);await client.connect(true, true);const files = await client.list('');this.message += "files:" + files.length;} catch (err) {this.message = "error:" + err;}})}}
}

调用:
 

  //获取路径下所有文件和文件夹信息list(remotePath: string): Promise<Array<FileInfo>>//获取文件流get(remotePath: string): Promise<ArrayBuffer | null>//获取文件并写入到指定路径下writeTo(remotePath: string, filePath: string): Promise<boolean>//上传文件到远程路径put(remotePath: string, filePath: string): Promise<boolean>//删除远端文件delete(remotePath: string): Promise<boolean>//移动远端文件mv(sourcePath: string, targetPath: string): Promise<boolean>//复制远端文件cp(sourcePath: string, targetPath: string): Promise<boolean>//创建文件夹mkdir(remotePath: string): Promise<boolean>//释放连接close(): void

但经过实测,只有list成功了,而且对服务器的版本有要求,如果服务器返回405是不能正常返回列表的,服务器返回200可以正常返回列表。

put(远程路径,本地路径) 这个调用发生了数据传输,但是远程未收到,本地也报错,报错提示native code,应该是上层so库没有详细的错误提示导致。

该生态尚不完善,需要各位同仁继续用爱发电。

[@dove/webdav(V0.2.3)],是一个 OpenHarmony/HarmonyOS webdav库,基于 ohos-rs 开发,支持使用 API13 以上。

http://www.xdnf.cn/news/18795.html

相关文章:

  • 最近遇到的几个JVM问题
  • JVM OOM问题排查与解决思路
  • Flask蓝图:模块化开发的利器
  • HarmonyOS NEXT系列之元服务框架ASCF
  • 第04章 SPSS简介与数据库构建
  • 【机器学习】9 Generalized linear models and the exponential family
  • BQTLOCK 勒索软件即服务出现,拥有复杂的规避策略
  • 大白话解析:多证明验证(Merkle Multi-Proof)​
  • 可视化-模块1-HTML-03
  • 基于SpringBoot的美食分享平台【2026最新】
  • 构建wezzer平台!
  • Indy HTTP Server 使用 OpenSSL 3.0
  • 知识蒸馏 Knowledge Distillation 1. 监督式微调(SFT):极大似然是前向 KL 的特例
  • Grafana k6 性能测试
  • 深度模块化剖析:构建一个健壮的、支持动态Cookie和代理的Python网络爬虫
  • 保姆级Maven安装与配置教程(Windows版)
  • 基于 MATLAB 的信号处理实战:滤波、傅里叶变换与频谱分析
  • 从文本树到结构化路径:解析有限元项目架构的自动化之道
  • 服务器硬件电路设计之 SPI 问答(四):3 线 SPI、Dual SPI 与 Qual SPI 的奥秘
  • Leetcode 3660. Jump Game IX
  • k8sday16调度器
  • MSF基础知识
  • Java 内存模型(JMM)与并发可见性:深入理解多线程编程的基石
  • Java:HashMap的使用
  • K8s 实战:六大核心控制器
  • 什么是 Nonce?
  • 电力电子simulink练习10:反激Flyback电路搭建
  • Linux 的 TCP 网络编程常用API
  • 图像均衡化详解:从直方图均衡到 CLAHE,让图片告别 “灰蒙蒙“
  • 高数 不定积分(4-3):分部积分法