summera / chromestore.js

Simple filesystem API wrapper for Chrome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Callback on failure!

MindOver opened this issue Β· comments

Hi @summera

Thankx for the API πŸ‘

I'm might not know how to use it properly, but if I'm trying to get a file, how can I set a callback if the file does not exist, when the flag create is set to false?

cs.getFile('data/foo.txt', {create: false, exclusive: true}, function (fileEntry) {
        console.log('File created', fileEntry);
});

Cheers,

Been a long time since I've used this, but I'm assuming an error is logged to the console? Probably NotFoundError?

If you look at the source, you will see we just pass this call off to the filesystem. If you look at the docs for the filesystem api, it says: If create is not true and the path doesn't exist, getFile must fail.

So I am guessing the errorHandler gets called. If so, we currently do not allow a custom errorHandler to be passed in, but I'm open to a pull request πŸ˜„. If that's not the case, let me know what the actual result is and what you would like it to be.

@HaNdTriX @MindOver going to close the issue. Let me know if you have any other questions