ebidel / idb.filesystem.js

HTML5 Filesystem API polyfill using IndexedDB
https://www.npmjs.com/package/idb.filesystem.js
Other
487 stars 46 forks source link

getFile and getDirectory - the options parameter is optional #15

Closed gwynjudd closed 11 years ago

gwynjudd commented 11 years ago

For example (http://www.w3.org/TR/file-system-api/ ):

fs.root.getFile("already_there.txt", null, function (f) { getAsText(f.file()); });

The second parameter to getFile is allowed to be null. In the implementation of getFile, it doesn't check for this and it will throw:

DirectoryEntry.prototype.getFile = function(path, options, successCallback, opt_errorCallback) {

// Create an absolute path if we were handed a relative one. path = resolveToFullPath_(this.fullPath, path);

idb_.get(path, function(fileEntry) { if (options.create === true && options.exclusive === true && fileEntry) { // If create and exclusive are both true, and the path already exists, // getFile must fail.