smartfile/dist/smartfile.local.js

63 lines
5.6 KiB
JavaScript
Raw Normal View History

/// <reference path="./typings/index.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);
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5sb2NhbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2Q0FBNkM7O0FBRTdDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFDaEQsSUFBTyxZQUFZLFdBQVcsaUJBQWlCLENBQUMsQ0FBQztBQUNqRCxJQUFPLG9CQUFvQixXQUFXLHlCQUF5QixDQUFDLENBQUM7QUFDdEQsWUF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