INNER CODE UNIT · JavaScript

filterJson

ruidoc/jueblog-combat · server/utils/index.js:10

const filterJson = (json, keys) => {
  return Object.fromEntries(
    Object.entries(json).filter(row => keys.includes(row[0]))
  )
}

const upload = multer({
  storage: multer.diskStorage({
    destination: (req, file, cb) => {
      let dirpath = uploadPath + 'uploads/' + dayjs().format('YYYY-MM-DD')
      if (!fs.existsSync(dirpath)) {
        fs.mkdirSync(dirpath, { recursive: true })
      }
      cb(null, dirpath)
    },
    filename: (req, file, cb) => {
      let length = 12 // 文件名长度
      let random_name = crypto

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…