2016-03-14 02:50:14 +00:00
|
|
|
/// <reference path="./typings/main.d.ts" />
|
|
|
|
|
|
|
|
import plugins = require("./smartfile.plugins");
|
2016-03-20 16:36:38 +00:00
|
|
|
import SmartfileGet = require("./smartfile.get");
|
|
|
|
import SmartfileInterpreter = require("./smartfile.interpreter");
|
2016-03-18 09:19:46 +00:00
|
|
|
export let toFS = function(options:{from:string,toPath:string}, cb=undefined){
|
|
|
|
|
2016-03-14 02:50:14 +00:00
|
|
|
};
|
|
|
|
|
2016-03-19 21:07:59 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param filePathArg
|
|
|
|
* @returns {*}
|
|
|
|
*/
|
|
|
|
export let toGulpStreamSync = function(filePathArg:string){
|
|
|
|
let stream = plugins.gulp.src(filePathArg);
|
|
|
|
return stream;
|
|
|
|
};
|
|
|
|
|
|
|
|
export let toGulpDestSync = function(folderPathArg:string){
|
|
|
|
return plugins.gulp.dest(folderPathArg);
|
|
|
|
};
|
|
|
|
|
2016-03-14 02:50:14 +00:00
|
|
|
/**
|
|
|
|
*
|
2016-03-20 16:36:38 +00:00
|
|
|
* @param filePathArg
|
2016-03-14 02:50:14 +00:00
|
|
|
* @param fileTypeArg
|
|
|
|
* @returns {any}
|
|
|
|
*/
|
2016-03-20 16:36:38 +00:00
|
|
|
export let toObjectSync = function(filePathArg,fileTypeArg?) {
|
|
|
|
let fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
|
2016-03-14 02:50:14 +00:00
|
|
|
let fileType;
|
2016-03-20 16:36:38 +00:00
|
|
|
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileGet.filetype(filePathArg);
|
|
|
|
return SmartfileInterpreter(fileString,fileType);
|
2016-03-14 02:50:14 +00:00
|
|
|
};
|
|
|
|
|
2016-03-18 09:19:46 +00:00
|
|
|
/**
|
|
|
|
* reads a file content to a String
|
|
|
|
* @param filePath
|
|
|
|
* @returns {string|Buffer|any}
|
|
|
|
*/
|
2016-03-18 16:34:31 +00:00
|
|
|
export let toStringSync = function(filePath) {
|
2016-03-18 09:19:46 +00:00
|
|
|
let fileString;
|
|
|
|
fileString = plugins.fs.readFileSync(filePath, "utf8");
|
|
|
|
return fileString;
|
|
|
|
};
|
|
|
|
|
2016-03-14 02:50:14 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param filePathArg
|
|
|
|
* @param options
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
2016-03-18 16:34:31 +00:00
|
|
|
export let toVinylSync = function(filePathArg,options = {}) {
|
2016-03-14 02:50:14 +00:00
|
|
|
return plugins.vinylFile.readSync(filePathArg,options);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* lets you reload files hot.
|
|
|
|
* @param path
|
|
|
|
* @returns {any}
|
|
|
|
*/
|
|
|
|
export let requireReload = function(path:string){
|
|
|
|
return plugins.requireReload(path);
|
|
|
|
};
|