Index: lib/io.js |
=================================================================== |
--- a/lib/io.js |
+++ b/lib/io.js |
@@ -10,67 +10,71 @@ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
+"use strict"; |
+ |
function readFileAsync(fileName) |
{ |
return new Promise((resolve, reject) => |
{ |
_fileSystem.read(fileName, (result) => |
{ |
if (result.error) |
return reject(result.error); |
resolve(result); |
}); |
}); |
-}; |
+} |
function writeFileAsync(fileName, content) |
{ |
return new Promise((resolve, reject) => |
{ |
_fileSystem.write(fileName, content, (error) => |
{ |
if (error) |
return reject(error); |
resolve(); |
}); |
}); |
-}; |
+} |
exports.IO = |
{ |
lineBreak: "\n", |
readFromFile(fileName, listener) |
{ |
return new Promise((resolve, reject) => |
{ |
- _fileSystem.readFromFile(fileName, listener, (error) => { |
+ _fileSystem.readFromFile(fileName, listener, (error) => |
+ { |
if (error) |
return reject(error); |
resolve(); |
}); |
}); |
}, |
writeToFile(fileName, generator) |
{ |
let content = Array.from(generator).join(this.lineBreak) + this.lineBreak; |
return writeFileAsync(fileName, content); |
}, |
copyFile(fromFileName, toFileName) |
{ |
- return readFileAsync(fromFileName).then(content => writeFileAsync(toFileName, content)); |
+ return readFileAsync(fromFileName).then( |
+ content => writeFileAsync(toFileName, content)); |
}, |
renameFile(fromFileName, newNameFile) |
{ |
return new Promise((resolve, reject) => |
{ |
_fileSystem.move(fromFileName, newNameFile, (error) => |
{ |