云存储文件访问

文件下载与读取

//下载文件内容
wx.cloud.downloadFile({
  fileID: 'cloud://cloud1-5gi8sbtn4cf6167f.636c-cloud1-5gi8sbtn4cf6167f-1308617741/data/stock/info/000001.json', 
  success: res => {
    // 返回临时文件路径
    console.log(res.fileContent)
  },
  fail: console.error
})
//读取文件内容
wx.request({
  url: 'http://tmp/KkPKNhGDrv0R7c9af5e4442b62fcdad4d876b321899c.json',
  header: {
    'content-type': 'application/json',
  },
  method: 'GET',
  dataType: 'JSON',
  responseType: 'text',
  success(text) {
    console.log(text);
    let data = JSON.parse(text.data);
    console.table(data);
  }
});