now can remove files

This commit is contained in:
2016-03-21 00:28:29 +01:00
parent 580cb95aa7
commit 20a3fdba03
12 changed files with 79 additions and 12 deletions

View File

@ -10,6 +10,7 @@ import SmartfileRemote = require("./smartfile.remote");
var smartfile:any = {
fsaction: SmartfileFsaction,
fs: plugins.fs,
checks: SmartfileChecks,
get: SmartfileGet,
local: SmartfileLocal,

View File

@ -30,3 +30,11 @@ export let fileExists = function(filePath){
});
return done.promise;
};
export let isDirectory = function(pathArg):boolean{
return plugins.fs.statSync(pathArg).isDirectory();
};
export let isFile = function(pathArg):boolean{
return plugins.fs.statSync(pathArg).isFile();
};

View File

@ -1,7 +1,30 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartfile.plugins");
import SmartfileChecks = require("./smartfile.checks");
export let copy = function(fromArg:string,toArg:string){
plugins.shelljs.cp("-r",fromArg,toArg);
export let copy = function(fromArg:string, toArg:string){
var done = plugins.q.defer();
plugins.fs.copy(fromArg,toArg,{},function(){
done.resolve();
});
return done.promise;
};
export let copySync = function(fromArg:string,toArg:string):boolean{
plugins.fs.copySync(fromArg,toArg);
return true;
};
export let remove = function(pathArg:string){
var done = plugins.q.defer();
plugins.fs.remove(pathArg,function(){
done.resolve();
});
return done.promise;
};
export let removeSync = function(pathArg:string):boolean{
plugins.fs.removeSync(pathArg);
return true;
};

View File

@ -12,4 +12,3 @@ export let vinylFile = require("vinyl-file");
export let yaml = require("js-yaml");
export let request = require("request");
export let requireReload = require("require-reload");
export let shelljs = require("shelljs");