File.writeFile() Error after app-scripts updated

So I used to be able to overwrite files with the following code:

File.writeFile(namePath, name, blob, true)
() => {
(error) => {
console.log(‘Could not rewrite existing image’);

but now it always rejects with Error Code 12 and PATH_EXISTS_ERR

It asks for permissions when I do for fresh install so it shouldn’t be a problem there.

Any ideas?

Ionic Framework: ^2.0.0-rc.3
Ionic Native: ^2.2.11
Ionic App Scripts: 0.0.47
Angular Core: 2.1.1
Angular Compiler CLI: 2.1.1
Node: 6.2.2

So I solved the issue by just using removeFile() first and the the writeFile().

Maybe you can also try the WriteOptions for replacing an existing file so you don’t need the delete method.

Here is the method declaration:
static writeFile(path: string, fileName: string, text: string | Blob, options: WriteOptions = {}): Promise<any>

Your use case with WritingOptions would look like this:

File.writeFile(namePath, name, blob, {replace:true}).then(() => ...

WriteOptions interface is this:

export interface WriteOptions {
  create?: boolean;
  replace?: boolean;
  append?: boolean;
  truncate?: number;

You can find some more information in the github repository:


Thank you so much! I didnt know that they had changed the syntax :confused:

Link is broken now:(

Try this one: