文件操作 - index.cjs
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/copy-anything/dist/cjs/index.cjs
编辑文件内容
'use strict'; const isWhat = require('is-what'); function assignProp(carry, key, newVal, originalObject, includeNonenumerable) { const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable"; if (propType === "enumerable") carry[key] = newVal; if (includeNonenumerable && propType === "nonenumerable") { Object.defineProperty(carry, key, { value: newVal, enumerable: false, writable: true, configurable: true }); } } function copy(target, options = {}) { if (isWhat.isArray(target)) { return target.map((item) => copy(item, options)); } if (!isWhat.isPlainObject(target)) { return target; } const props = Object.getOwnPropertyNames(target); const symbols = Object.getOwnPropertySymbols(target); return [...props, ...symbols].reduce((carry, key) => { if (isWhat.isArray(options.props) && !options.props.includes(key)) { return carry; } const val = target[key]; const newVal = copy(val, options); assignProp(carry, key, newVal, target, options.nonenumerable); return carry; }, {}); } exports.copy = copy;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件