smartfile/dist/smartfile.local.js

63 lines
5.4 KiB
JavaScript
Raw Normal View History

/// <reference path="./typings/main.d.ts" />
"use strict";
var plugins = require("./smartfile.plugins");
var SmartfileGet = require("./smartfile.get");
var SmartfileInterpreter = require("./smartfile.interpreter");
exports.toFS = function (options, cb) {
if (cb === void 0) { cb = undefined; }
};
2016-03-19 21:07:59 +00:00
/**
*
* @param filePathArg
* @returns {*}
*/
exports.toGulpStreamSync = function (filePathArg) {
var stream = plugins.gulp.src(filePathArg);
return stream;
};
exports.toGulpDestSync = function (folderPathArg) {
return plugins.gulp.dest(folderPathArg);
};
/**
*
* @param filePathArg
* @param fileTypeArg
* @returns {any}
*/
exports.toObjectSync = function (filePathArg, fileTypeArg) {
var fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
var fileType;
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileGet.filetype(filePathArg);
return SmartfileInterpreter(fileString, fileType);
};
/**
* reads a file content to a String
* @param filePath
* @returns {string|Buffer|any}
*/
exports.toStringSync = function (filePath) {
var fileString;
fileString = plugins.fs.readFileSync(filePath, "utf8");
return fileString;
};
/**
*
* @param filePathArg
* @param options
* @returns {number}
*/
exports.toVinylSync = function (filePathArg, options) {
if (options === void 0) { options = {}; }
return plugins.vinylFile.readSync(filePathArg, options);
};
/**
* lets you reload files hot.
* @param path
* @returns {any}
*/
exports.requireReload = function (path) {
return plugins.requireReload(path);
};
2016-05-01 21:19:54 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5sb2NhbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw0Q0FBNEM7O0FBRTVDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFDaEQsSUFBTyxZQUFZLFdBQVcsaUJBQWlCLENBQUMsQ0FBQztBQUNqRCxJQUFPLG9CQUFvQixXQUFXLHlCQUF5QixDQUFD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