字節(jié)跳動(dòng)小程序開發(fā)API FileSystemManager.readFile

2019-08-27 17:18 更新

FileSystemManager.readFile(Object object)

讀取本地文件內(nèi)容

輸入


繼承標(biāo)準(zhǔn)對(duì)象輸入,擴(kuò)展屬性描述:

屬性 類型 默認(rèn)值 是否必填 說明
filePath string 要讀取的文件的路徑
encoding string 指定讀取文件的字符編碼,如果不傳 encoding,則以 ArrayBuffer 格式讀取文件的二進(jìn)制內(nèi)容
說明
ascii
base64
binary
hex
ucs2/ucs-2/utf16le/utf-16le 以小端序讀取
utf-8/utf8
latin1

輸出


success 回調(diào)函數(shù)參數(shù) Object

屬性 類型 說明
data string/ArrayBuffer 文件內(nèi)容

fail 回調(diào)函數(shù)參數(shù) Object

屬性 類型 說明 支持版本
errMsg string 錯(cuò)誤信息
說明
fail no such file or directory, open ${filePath} 指定的 filePath 所在目錄不存在
fail permission denied, open ${dirPath} 指定的 filePath 路徑?jīng)]有讀權(quán)限


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)