uvue.uts 356 B

123456789101112131415
  1. import { processFile, ProcessFileOptions } from '@/uni_modules/lime-file-utils'
  2. export function pathToBase64(path : string) : Promise<string> {
  3. return new Promise((resolve, reject) => {
  4. processFile({
  5. type: 'toDataURL',
  6. path,
  7. success(res : string) {
  8. resolve(res)
  9. },
  10. fail(err: any){
  11. reject(err)
  12. }
  13. } as ProcessFileOptions)
  14. })
  15. }