| 1234567891011121314151617181920212223242526 | 
							- const fsm = wx.getFileSystemManager();
 
- function base64src(base64data, fileName) {
 
-   fileName = fileName || 'file_base64src'; //自定义文件名
 
-   const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
 
-   if (!format) {
 
-     return (new Error('ERROR_BASE64SRC_PARSE'));
 
-   }
 
-   const filePath = `${wx.env.USER_DATA_PATH}/${fileName}.${format}`;
 
-   const buffer = wx.base64ToArrayBuffer(bodyData);
 
-   return new Promise((resolve, reject) =>{
 
-     fsm.writeFile({
 
-         filePath,
 
-         data: buffer,
 
-         encoding: 'binary',
 
-         success() {
 
-             resolve(filePath);
 
-         },
 
-         fail() {
 
-             reject(new Error('ERROR_BASE64SRC_WRITE'));
 
-         },
 
-     });
 
-   })
 
- };
 
- export { base64src };
 
 
  |