ab-plugin-file@文件操作类
1.引入
2.使用
获取客户端跟路径
支持移动渠道
对应移动原SDK:
AgreeSDK.file.xxx
readClientFile --读取客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 参数差异 | 说明 |
| filePath | string | √ | ----- | 文件路径 |
| encoding | boolstringean | √ | ----- | 例"gbk" |
| offset | number | √ | 移动端可缺省 | 偏移量 0(不偏移) |
| size | number | √ | 移动端可缺省 | 读取量 -1(全部读取) |
| 参数 | 类型 | 说明 |
| res.resultArray | string | 读取结果 |
对应移动原SDK:
let fileReader = new AgreeSDK.file.FileReader();
fileReader.readAsText()
clientDirCreate --创建深度遍历客户端文件夹
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件夹绝对路径 |
| 参数 | 类型 | 说明 |
| res.result | string | 'true':创建成功;'false':创建失败 |
对应移动原SDK: AgreeSDK.file.mkdirSync()
clientFileCreate --创建客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| clientFileCreate | boolean | true:创建成功;false:创建失败 |
对应移动原SDK: AgreeSDK.file.createFile()
clientFileDelete --删除客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| clientFileDelete | boolean | true:删除成功;false:删除失败 |
对应移动原SDK: AgreeSDK.file.deleteFile()
isFileExist --文件是否存在
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| path | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| clientFileExist | object | 文件是否存在结果对象 |
对应移动原SDK: AgreeSDK.file.isFileExist
clientFileIsDir -- 判断当前路径是否为文件夹
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| res.result | string | "true":是;"false":否 |
getFileLength -- 获取文件大小
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 参数差异 | 说明 |
| path | string | √ | --- | 文件路径 |
| unitType | string | √ | 移动端不支持 | 类型 |
| 参数 | 类型 | 说明 |
| res.size | string | "0.0"(文件大小结果) |
对应移动原SDK: AgreeSDK.file.getFileInfo
clientFileReadLines --柜面自有:按行读取客户端文件
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| startLines | int | √ | 首行行数 |
| endLines | int | √ | 最后一行行数 |
| 参数 | 类型 | 说明 |
| res.clientFileCreate | string | 读取结果 |
clientFileRename --客户端文件重命名
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| oldName | string | √ | 旧客户端文件全路径 |
| newName | string | √ | 新客户端文件全路径 |
| 参数 | 类型 | 说明 |
| res.clientFileRename | boolean | true:成功;false:失败 |
对应移动原SDK: AgreeSDK.file.rename()
clientFilesGetList --获取文件列表
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| fileTypes | string | √ | 获取文件格式 |
| 参数 | 类型 | 说明 |
| obj | object | 例:{"name":"Config.xml","size":176,"path":"file:///emulated/0/amap/Config.xml"} |
对应移动原SDK: AgreeSDK.file.getFilesFromDirectory()
downloadFile --文件下载
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| remotePath | string | √ | 服务端文件地址 |
| localPath | string | √ | 本地文件地址 |
| fileName | string | √ | 文件名称 |
| serviceName | string | √ | 服务端名称 (移动端需传完整的url) |
| legalNum | string | x | 柜员号 |
| 参数 | 类型 | 说明 |
| downloadFile | boolean | 是否下载成功 |
对应移动原SDK: AgreeSDK.ft.downloadFile()
getClientFileAsSavePath --柜面自有:获取客户端打开文件路径
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| fileTypesList | list | √ | 支持打开文件的类型 默认不传值可以打开全部类型文件 |
| behavior | string | √ | 模态对话框打开样式 默认为open |
| fileName | string | √ | 文件名称 |
| filterPath | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| res.path | string | 路径结果 |
listToExcel -- 柜面自有:导出表格
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| data | list | √ | list格式data |
| excelFilePath | string | √ | excel导出文件路径 |
| head | string | √ | 头部 |
| sheetName | string | x | 内部sheet名称,非必输 |
| fontSize | number | x | 字体大小,非必输 |
| fontName | string | x | 字体名称,非必输 |
| FontColor | string | x | FontColor,非必输 |
| backgroundColor | string | x | 背景颜色,非必输 |
| 参数 | 类型 | 说明 |
| res.result | string | "true":成功 |
pdfToTxt -- pdf转txt
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| pdfPath | string | √ | pdf文件绝对路径 |
| txtPath | string | √ | txt文件绝对路径 |
| encoding | string | √ | 编码,默认为UTF-8 |
| 参数 | 类型 | 说明 |
| res.result | string | "true":成功 |
readClientExcel -- 读取客户端excel
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| excelPath | string | √ | excel文件绝对路径 |
| index | number | √ | sheet index(例:index=1从1开始) |
| 参数 | 类型 | 说明 |
| res.result | string | "true":成功 |
readClientFileBase64 -- 读取客户端文件,返回base64字符串
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| 参数 | 类型 | 说明 |
| res.Base64Str | string | 例"MjEzMzMzMzMzMzMz"(base64字符串) |
对应移动原SDK: AgreeSDK.file.fileToBase64
uploadFile -- 更新客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| localPath | string | √ | 本地路径 |
| remotePath | string | √ | 远程路径 |
| serviceName | string | √ | 服务器名 |
| isAbsolutePath | boolean | √ | 是否绝对路径 |
| override | boolean | √ | 是否覆盖已有文件 |
| 参数 | 类型 | 说明 |
| res.result | string | 是否更新成功 |
对应移动原SDK: AgreeSDK.ft.uploadFile
wordToTxt -- word转txt
支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| wordPath | string | √ | word文件绝对路径 |
| txtPath | string | √ | txt文件绝对路径 |
| encoding | string | √ | 编码,默认为UTF-8 |
| 参数 | 类型 | 说明 |
| res.result | string | 文本内容 |
writeClientFile -- 写客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| filePath | string | √ | 文件路径 |
| content | string | √ | 写入文件的内容 |
| append | string | √ | 是否追加写入 |
| encoding | string | - | 编码格式 |
| 参数 | 类型 | 说明 |
| res.clientFileWrite | boolean | 写入结果 |
对应移动原SDK: AgreeSDK.file.createFile()
clientFileCopy -- 复制客户端文件
支持移动渠道 支持柜面渠道
| 参数 | 类型 | 必填参数 | 说明 |
| sourceFile | string | √ | 原文件全路径 |
| destinationFile | string | √ | 文件全路径 |
| 参数 | 类型 | 说明 |
| res.result | string | 复制结果("true":成功;"false":失败) |
对应移动原SDK: AgreeSDK.file.copyFile()