How to use fire-fs - 10 common examples

To help you get started, we’ve selected a few fire-fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tidys / CocosCreatorPlugins / packages / mp3-compress / panel / item / image-item.js View on Github external
init() {
        console.log("image-item 注册组件!");
        Vue.component('image-item', {
            props: ['data', 'index'],
            template: fs.readFileSync(Editor.url('packages://' + packageName + '/panel/item/image-item.html', 'utf8')) + "",
            created() {

            },
            methods: {
                onBtnClickCompress() {
                    // this.data.isUse=!this.data.isUse;
                    // console.log("on use: " + this.data.isUse);
                    // console.log("压缩");
                    // console.log(this.data);
                    window.plugin.onImageItemCompress(this.data);
                }
            },
            computed: {},
        });
    }
};
github tidys / CocosCreatorPlugins / packages / hot-update-tools / panel / index.js View on Github external
_initLocalServerDir() {
                    if (this.localServerPath && this.localServerPath.length > 0) {
                        console.log("已经有本地server目录");
                    } else {
                        let zipDir = CfgUtil.getPackZipDir();
                        if (!fs.existsSync(zipDir)) {
                            fs.mkdirSync(zipDir);
                        }
                        let serverDir = path.join(zipDir, "server");
                        if (!fs.existsSync(serverDir)) {
                            fs.mkdirSync(serverDir);
                        }
                        this.localServerPath = serverDir;
                    }
                },
                // 选择项目的manifest文件目录
github tidys / CocosCreatorPlugins / packages / resize-image / panel / index.js View on Github external
_resizeImage(imgPath) {
                    if (!imgPath) {
                        this._addLog("图片路径有误: " + imgPath);
                        return;
                    }

                    let sharpPath = Editor.url('unpack://utils/sharp');
                    let sharp = require(sharpPath);

                    // 创建相应尺寸的目录
                    let desDir = this._getTempDir();
                    if (!fs.existsSync(desDir)) {
                        fs.mkdirSync(desDir);
                    }
                    let pixDir = path.join(desDir, this.sizeWidth + "x" + this.sizeHeight);
                    if (!fs.existsSync(pixDir)) {
                        fs.mkdirSync(pixDir);
                    }
                    let fileName = path.basename(imgPath);
                    let desFilePath = path.join(pixDir, fileName);

                    sharp(imgPath).resize(this.sizeWidth, this.sizeHeight).toFile(desFilePath, function (err, info) {
                        if (err) {
                            this._addLog("裁剪失败!" + imgPath);
                            // Editor.warn("error:"+err);
                            console.log("error:" + err);
                            console.log("info: " + info);
                        } else {
github tidys / CocosCreatorPlugins / packages / mp3-compress / panel / index.js View on Github external
_compressMp3(fileDataArray) {
                    // 设置lame路径
                    let lamePath = this._getLamePath();
                    if (!fs.existsSync(lamePath)) {
                        this._addLog("文件不存在: " + lamePath);
                        return;
                    }
                    console.log("压缩");
                    co(function* () {
                        // 处理要压缩的音频文件
                        for (let i = 0; i < fileDataArray.length; i++) {
                            let voiceFile = fileDataArray[i].path;
                            let voiceFileUrl = fileDataArray[i].url;
                            if (!fs.existsSync(voiceFile)) {
                                this._addLog("声音文件不存在: " + voiceFile);
                                return;
                            }

                            if (path.extname(voiceFile) === ".mp3") {
                                // 检测临时缓存目录
github tidys / CocosCreatorPlugins / packages / res-compress / panel / index.js View on Github external
_compressMp3(fileDataArray) {
                    // 设置lame路径
                    let lamePath = this._getLamePath();
                    if (!fs.existsSync(lamePath)) {
                        this._addLog("文件不存在: " + lamePath);
                        return;
                    }
                    console.log("压缩");
                    co(function* () {
                        // 处理要压缩的音频文件
                        for (let i = 0; i < fileDataArray.length; i++) {
                            let voiceFile = fileDataArray[i].path;
                            let voiceFileUrl = fileDataArray[i].url;
                            if (!fs.existsSync(voiceFile)) {
                                this._addLog("声音文件不存在: " + voiceFile);
                                return;
                            }

                            if (path.extname(voiceFile) === ".mp3") {
                                // 检测临时缓存目录
github tidys / CocosCreatorPlugins / packages / mp3-compress / panel / index.js View on Github external
results.forEach(function (result) {
                                            //   删除临时目录的文件
                                            // console.log("type: " + result.type);
                                            if (result.type = "audio-clip") {
                                                console.log("del: " + result.path);
                                                if (fs.existsSync(newNamePath)) {
                                                    fs.unlinkSync(newNamePath);// 删除临时文件
                                                }
                                            }
                                        });
                                    }.bind(this));
github tidys / CocosCreatorPlugins / packages / res-compress / panel / index.js View on Github external
results.forEach(function (result) {
                                            //   删除临时目录的文件
                                            // console.log("type: " + result.type);
                                            if (result.type = "audio-clip") {
                                                console.log("del: " + result.path);
                                                if (fs.existsSync(newNamePath)) {
                                                    fs.unlinkSync(newNamePath);// 删除临时文件
                                                }
                                            }
                                        });
                                    }.bind(this));
github tidys / CocosCreatorPlugins / packages / hot-update-tools / mail / Mail.js View on Github external
service: this._service,
            auth: {
                user: this._user,
                pass: this._pass, //授权码,通过QQ获取
            }
        });

        let sendPeople = ['xu_yanfeng@126.com'];
        if (this.isArray(people)) {
            for (let k in people) {
                sendPeople.push(people[k]);
            }
        } else if (typeof people === "string") {
            sendPeople.push(people);
        }
        let data = Fs.readFileSync(Editor.url('packages://hot-update-tools/mail/MailTemp.html', 'utf8')).toString();
        if (data.indexOf('%version%') !== -1) {
            data = data.replace("%version%", version);
        }
        if (data.indexOf('%content%') !== -1) {
            data = data.replace("%content%", content);
        }
        let mailOptions = {
            from: this._user, // 发送者
            to: sendPeople.toString(), // 接受者,可以同时发送多个,以逗号隔开
            subject: '测试版本 发布通知-v' + version, // 标题
            text: 'Hello world', // 文本
            html: data,
        };
        transporter.sendMail(mailOptions, function (err, info) {
            if (sendCb) {
                sendCb();
github tidys / CocosCreatorPlugins / packages / plugin-4399-web-js-sdk / panel / index.js View on Github external
var FS = require("fire-fs");
var PATH = require('fire-path');
var CfgUtil = Editor.require("packages://plugin-4399-web-js-sdk/core/CfgUtil");

Editor.Panel.extend({
    style: FS.readFileSync(Editor.url('packages://plugin-4399-web-js-sdk/panel/index.css', 'utf8')) + "",
    template: FS.readFileSync(Editor.url('packages://plugin-4399-web-js-sdk/panel/index.html', 'utf8')) + "",

    $: {
        logTextArea: '#logTextArea',
    },

    ready() {
        let logCtrl = this.$logTextArea;
        let logListScrollToBottom = function () {
            setTimeout(function () {
                logCtrl.scrollTop = logCtrl.scrollHeight;
            }, 10);
        };
        // Editor.Ipc.sendToMain('plugin-4399-web-js-sdk:clicked');
        window.plugin = new window.Vue({
            el: this.shadowRoot,
github tidys / CocosCreatorPlugins / packages / hot-update-tools / core / CfgUtil.js View on Github external
updateBuildTimeByMain(time) {
        // 在main.js中调用electron中没有remote属性
        // Editor.log(electron.app.getPath('userData'));
        let cfgPath = this._getAppCfgPath();
        if (fs.existsSync(cfgPath)) {
            let data = fs.readFileSync(cfgPath, 'utf-8');
            let json = JSON.parse(data);
            json.buildTime = time;
            json.genTime = time;
            fs.writeFileSync(cfgPath, JSON.stringify(json));
        } else {
            Editor.log("热更新配置文件不存在: " + cfgPath);
        }
    },
    updateBuildTime(time) {

fire-fs

node's fs module with some helpful additions.

MIT
Latest version published 9 years ago

Package Health Score

36 / 100
Full package analysis

Popular fire-fs functions