Help with Ionic Native File

I can’t seem to get Ionic Native File to work. Does it work in Ionic Viewer?

I have some very simple code - I’d like to just create a log file locally, and update it with major errors. I’m getting a TypeError from it when I call alert with the error. I’m also not sure how to see the whole error, I just see Couldnt create dir TypeError.

Any help would be amazing!

import { Injectable } from ‘@angular/core’;
import { File } from ‘@ionic-native/file’;

@Injectable()
export class StorageService {

writeFile(fileName: string, text: string) {
let file = new File();
file.writeFile(file.externalApplicationStorageDirectory,
“log.txt”, “test”)
.then(_ => alert(‘Directory created’))
.catch(err => alert(‘Couldnt create dir’ + err));
}
};