You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.5 KiB
33 lines
1.5 KiB
|
7 days ago
|
// 下载最新版 Axure JSON 并检查结构
|
||
|
|
import fs from 'node:fs';
|
||
|
|
|
||
|
|
const JSON_URL = 'https://lanhu-axure-file.oss-cn-beijing.aliyuncs.com/md5b013dded-642f-4899-b829-daa5c093fdf0__e0c423279b681ba8705ea7fe5039ef54.json';
|
||
|
|
|
||
|
|
const res = await fetch(JSON_URL, {
|
||
|
|
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' },
|
||
|
|
});
|
||
|
|
console.log('status:', res.status, '| content-length:', res.headers.get('content-length'), '| content-type:', res.headers.get('content-type'));
|
||
|
|
const text = await res.text();
|
||
|
|
console.log('bytes:', text.length);
|
||
|
|
fs.writeFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/axure-v29.json', text, 'utf8');
|
||
|
|
|
||
|
|
// 结构探查
|
||
|
|
const data = JSON.parse(text);
|
||
|
|
const keys = Object.keys(data);
|
||
|
|
console.log('top-level keys:', keys.slice(0, 30).join(', '), keys.length > 30 ? `(+${keys.length - 30})` : '');
|
||
|
|
|
||
|
|
// 递归浅探
|
||
|
|
function probe(obj, depth, label) {
|
||
|
|
if (depth <= 0 || obj === null || typeof obj !== 'object') return;
|
||
|
|
if (Array.isArray(obj)) {
|
||
|
|
console.log(`${label}: array[${obj.length}]`, obj.length > 0 ? `first-item-keys: ${Object.keys(obj[0] || {}).slice(0, 15).join(',')}` : '');
|
||
|
|
if (obj.length > 0 && typeof obj[0] === 'object') probe(obj[0], depth - 1, label + '[0]');
|
||
|
|
} else {
|
||
|
|
for (const [k, v] of Object.entries(obj).slice(0, 12)) {
|
||
|
|
const t = Array.isArray(v) ? `array[${v.length}]` : (v && typeof v === 'object' ? `obj{${Object.keys(v).slice(0, 8).join(',')}}` : `${typeof v}:${String(v).slice(0, 60)}`);
|
||
|
|
console.log(`${label}.${k} = ${t}`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
probe(data, 2, 'root');
|