Comparing version 0.0.3 to 0.0.4
50
index.js
@@ -108,2 +108,6 @@ module.exports = new (function() { | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
path = path.trim(); | ||
@@ -141,2 +145,6 @@ var storage = getStorageForPath(path); | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
this.open(path, 'r', function(error, file) { | ||
@@ -149,2 +157,6 @@ callback(null, (error) ? false : true); | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
if (!fd) { | ||
@@ -189,2 +201,6 @@ throw new Error('Missing File.'); | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
var options = { | ||
@@ -244,2 +260,6 @@ encoding: opts.encoding || null, | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
if (!fd) { | ||
@@ -299,2 +319,6 @@ throw new Error('Missing File.'); | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
this.exists(filename, function(error, exists) { | ||
@@ -330,2 +354,5 @@ if (error) { | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
var storage = getStorageForPath(path); | ||
@@ -357,2 +384,25 @@ if (!storage) { | ||
}; | ||
this.unlink = function(path, callback) | ||
{ | ||
if (typeof callback !== 'function') { | ||
var callback = function() {}; | ||
} | ||
var filepath = getPathWithoutStorageType(path); | ||
var storage = getStorageForPath(path); | ||
if (!storage) { | ||
callback(new Error('Unable to find entry point for ' + path + '.')); | ||
return; | ||
} | ||
var request = storage.delete(filepath); | ||
request.onsuccess = function() | ||
{ | ||
callback(null); | ||
}; | ||
request.onerror = function() | ||
{ | ||
callback(this.error); | ||
}; | ||
}; | ||
})(); |
{ | ||
"name": "ffos-fs", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "fs module for the Firefox OS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,2 +60,8 @@ ffos-fs | ||
**Remove a file or directory.** | ||
```javascript | ||
fs.unlink(path, callback(error) { ... }); | ||
``` | ||
---------------------------- | ||
@@ -62,0 +68,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14206
341
116