lib/modules/scripts.js
function get(scriptModule, agent, msg, cb) {
    const filename = msg.filename;
    if (!filename) {
        cb('empty filename');
        return;
    }

    fs.readFile(path.join(scriptModule.root, filename), 'utf-8', (err, data) => {
        if (err) {
            logger.error(`fail to read script file:${filename}, ${err.stack}`);
            cb(`fail to read script with name:${filename}`);
        }

        cb(null, data);
    });
}
function get(scriptModule, agent, msg, cb) {
    const filename = msg.filename;
    if (!filename) {
        cb('empty filename');
        return;
    }

    fs.readFile(path.join(scriptModule.root, filename), 'utf-8', (err, data) => {
        if (err) {
            logger.error(`fail to read script file:${filename}, ${err.stack}`);
            cb(`fail to read script with name:${filename}`);
        }

        cb(null, data);
    });
}
function get ( scriptModule , agent , msg , cb ) { const filename = msg . filename ; if ( ! filename ) { cb ( 'empty filename' ) ; return ; } fs . readFile ( path . join ( scriptModule . root , filename ) , 'utf-8' , ( err , data ) => { if ( err ) { logger . error ( ` ${ filename } ${ err . stack } ` ) ; cb ( ` ${ filename } ` ) ; } cb ( null , data ) ; } ) ; }
Get the content of the script file
Get the content of the script file