文件操作 - utils.js
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/svg-baker/lib/utils.js
编辑文件内容
const { interpolateName, getHashDigest } = require('loader-utils'); /** * @param {PostHTMLTree} tree * @return {Object} Node */ exports.getRoot = function getRoot(tree) { return tree.find(node => typeof node === 'object' && 'tag' in node); }; /** * @param {string|Function} pattern * @param {string} resourcePath * @param {Object} [options] * @param {string} options.context * @param {string} options.content * @param {string} options.regExp */ exports.interpolate = function interpolate(pattern, resourcePath, options = null) { const opts = Object.assign({ context: process.cwd() }, options); return interpolateName({ resourcePath }, pattern, opts); }; exports.getHash = function getHash(content) { return getHashDigest(content, 'md5', 'hex', 6); };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件