smartfile/dist/smartfile.fsaction.js

28 lines
3.0 KiB
JavaScript
Raw Normal View History

2016-03-18 09:19:46 +00:00
"use strict";
require("typings-global");
2016-03-18 09:19:46 +00:00
var plugins = require("./smartfile.plugins");
exports.copy = function (fromArg, toArg) {
2016-03-20 23:28:29 +00:00
var done = plugins.q.defer();
plugins.fs.copy(fromArg, toArg, {}, function () {
done.resolve();
});
return done.promise;
};
exports.copySync = function (fromArg, toArg) {
plugins.fs.copySync(fromArg, toArg);
return true;
};
exports.remove = function (pathArg) {
var done = plugins.q.defer();
plugins.fs.remove(pathArg, function () {
done.resolve();
});
return done.promise;
};
exports.removeSync = function (pathArg) {
plugins.fs.removeSync(pathArg);
return true;
2016-03-18 09:19:46 +00:00
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5mc2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFHckMsWUFBSSxHQUFHLFVBQVMsT0FBYyxFQUFFLEtBQVk7SUFDbkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixPQUFPLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxPQUFPLEVBQUMsS0FBSyxFQUFDLEVBQUUsRUFBQztRQUM3QixJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDbkIsQ0FBQyxDQUFDLENBQUM7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUM7QUFFUyxnQkFBUSxHQUFHLFVBQVMsT0FBYyxFQUFDLEtBQVk7SUFDdEQsT0FBTyxDQUFDLEVBQUUsQ0FBQyxRQUFRLENBQUMs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