Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/vreg/node_modules/postcss-url/src/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/vreg/node_modules/postcss-url/src/lib/get-file.js
'use strict';

const fs = require('fs');
const mime = require('mime');

const getPathByBasePath = require('./paths').getPathByBasePath;

/**
 *
 * @param {PostcssUrl~Asset} asset
 * @param {PostcssUrl~Options} options
 * @param {PostcssUrl~Dir} dir
 * @param {Function} warn
 * @returns {PostcssUrl~File}
 */
const getFile = (asset, options, dir, warn) => {
    const paths = options.basePath
        ? getPathByBasePath(options.basePath, dir.from, asset.pathname)
        : [asset.absolutePath];
    const filePath = paths.find(fs.existsSync);

    if (!filePath) {
        warn(`Can't read file '${paths.join()}', ignoring`);

        return;
    }

    return {
        path: filePath,
        contents: fs.readFileSync(filePath),
        mimeType: mime.getType(filePath)
    };
};

module.exports = getFile;

/**
 * @typedef {Object} PostcssUrl~File
 * @property {String} path
 * @property {Buffer} contents
 * @property {String} mimeType
 */

Spamworldpro Mini