Answers for "ionic get file from device"

1

ionic get file from device

import { FilePath } from '@ionic-native/file-path/ngx';
import { File, FileEntry } from '@ionic-native/File/ngx';

// uri is something like file:///data/user/0/com.company.app/files/1591951119970.jpeg
 this.file.resolveLocalFilesystemUrl(finalPhotoUri.uri)
        .then(entry => {
          (<FileEntry>entry).file(file => {
            // this is the actual file as File object
            const photo = this.imageService.readFile(file);
            console.log(photo);
          }
          );
        })
        .catch(err => {
          console.log('Error while reading file.');
        });
Posted by: Guest on June-12-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language