1. 程式人生 > 其它 >小程式 writeFile引數filePath要怎麼寫

小程式 writeFile引數filePath要怎麼寫

技術標籤:小程式小程式javascript

1

// 在本地使用者檔案目錄下建立一個檔案 hello.txt,寫入內容 "hello, world"
const fs = wx.getFileSystemManager()
fs.writeFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'hello, world', 'utf8')
// 寫入圖片
fsm.writeFile({
          filePath:`${wx.env.USER_DATA_PATH}/a.jpg`,
          data: buffer,
          encoding:
'binary', success() { // resolve(filePath); wx.getImageInfo({ src: `${wx.env.USER_DATA_PATH}/a.jpg`, success: function (res) { console.log(res) resolve(res); }, })

小程式API文件介紹