lib/modules/scripts.js
function save(scriptModule, agent, msg, cb) {
    const filepath = path.join(scriptModule.root, msg.filename);

    fs.writeFile(filepath, msg.body, (err) => {
        if (err) {
            logger.error(`fail to write script file:${msg.filename}, ${err.stack}`);
            cb(`fail to write script file:${msg.filename}`);
            return;
        }

        cb();
    });
}
function save(scriptModule, agent, msg, cb) {
    const filepath = path.join(scriptModule.root, msg.filename);

    fs.writeFile(filepath, msg.body, (err) => {
        if (err) {
            logger.error(`fail to write script file:${msg.filename}, ${err.stack}`);
            cb(`fail to write script file:${msg.filename}`);
            return;
        }

        cb();
    });
}
function save ( scriptModule , agent , msg , cb ) { const filepath = path . join ( scriptModule . root , msg . filename ) ; fs . writeFile ( filepath , msg . body , ( err ) => { if ( err ) { logger . error ( ` ${ msg . filename } ${ err . stack } ` ) ; cb ( ` ${ msg . filename } ` ) ; return ; } cb ( ) ; } ) ; }
Save a script file that posted from admin console
Save a script file that posted from admin console