Gathering detailed insights and metrics for vdf-faster
Gathering detailed insights and metrics for vdf-faster
Gathering detailed insights and metrics for vdf-faster
Gathering detailed insights and metrics for vdf-faster
npm install vdf-faster
Typescript
Module System
Node Version
NPM Version
69.4
Supply Chain
99.3
Quality
80.3
Maintenance
100
Vulnerability
100
License
TypeScript (90.41%)
JavaScript (9.59%)
Total Downloads
803
Last Day
1
Last Week
2
Last Month
22
Last Year
803
MIT License
36 Commits
2 Branches
2 Contributors
Updated on Mar 23, 2025
Latest Version
2.1.6
Package Id
vdf-faster@2.1.6
Unpacked Size
15.34 kB
Size
6.39 kB
File Count
5
NPM Version
8.19.3
Node Version
16.19.0
Published on
Apr 25, 2025
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
100%
2
Compared to previous week
Last Month
-24.1%
22
Compared to previous month
Last Year
0%
803
Compared to previous year
6
一个高性能的 Valve Data Format (VDF) 解析器,专为 Dota 2 自定义游戏开发优化。 A high-performance Valve Data Format (VDF) parser optimized for Dota 2 custom game development.
🚀 高性能: 相比其他VDF解析器,提供更快的解析速度 High Performance: Provides faster parsing speed compared to other VDF parsers
🎯 完整的#base支持: 正确处理和解析#base指令 Complete #base Support: Correctly handles and parses #base directives
💪 健壮性: 完善的错误处理和边界情况支持 Robustness: Comprehensive error handling and edge case support
🔄 双向转换: 支持VDF与JSON对象的双向转换 Bidirectional Conversion: Supports bidirectional conversion between VDF and JSON objects
🎮 游戏开发优化: 专为Dota 2自定义游戏开发场景优化 Game Development Optimization: Specially optimized for Dota 2 custom game development scenarios
1npm install vdf-faster
1import { decode, encode } from 'vdf-faster'; 2 3// VDF转JSON 4// VDF to JSON 5const vdfString = ` 6"root" { 7 "key" "value" 8 "nested" { 9 "number" "42" 10 } 11} 12`; 13 14const jsonData = decode(vdfString); 15console.log(jsonData); 16// 输出 | Output: { root: { key: 'value', nested: { number: '42' } } } 17 18// JSON转VDF 19// JSON to VDF 20const vdfOutput = encode(jsonData); 21console.log(vdfOutput); 22// 输出VDF格式字符串 23// Outputs VDF formatted string
1import { decode } from 'vdf-faster'; 2 3const vdfWithBase = ` 4#base "npc_units_custom.txt" 5#base "npc_heroes_custom.txt" 6 7"CustomUnits" { 8 // ... 9} 10`; 11 12// 处理#base指令 13// Process #base directives 14decode(vdfWithBase, (bases) => { 15 console.log('Found base files:', bases); 16 // 输出 | Output: ['npc_units_custom.txt', 'npc_heroes_custom.txt'] 17});
1import { decoder } from 'vdf-faster'; 2 3// 创建解码器实例 4// Create decoder instance 5const vdfDecoder = decoder.getNPCDecoder(vdfContent); 6 7// 获取base文件列表 8// Get base file list 9const baseFiles = vdfDecoder.getBase(); 10 11// 获取解析后的数据 12// Get parsed data 13const jsonData = vdfDecoder.getDataJson('npc_dota_announcer_aghanim'); 14 15// 获取原始VDF格式数据 16// Get original VDF formatted data 17const vdfData = vdfDecoder.getDataCode('npc_dota_announcer_aghanim');
将VDF格式字符串转换为JSON对象。
Converts VDF formatted string to JSON object.
code
: 要解析的VDF格式字符串
The VDF formatted string to parse
baseHandle
: 可选的回调函数,用于处理#base指令
Optional callback function for handling #base directives
返回: 解析后的JSON对象
Returns: Parsed JSON object
将JSON对象转换为VDF格式字符串。
Converts JSON object to VDF formatted string.
data
: 要转换的JSON对象
The JSON object to convert
返回: VDF格式字符串
Returns: VDF formatted string
提供更细粒度的VDF解析控制:
Provides more granular VDF parsing control:
getBase()
: 获取所有#base文件路径
Get all #base file paths
getDataJson(key: string)
: 获取指定键的JSON格式数据
Get JSON formatted data for the specified key
getDataCode(key: string)
: 获取指定键的VDF格式数据
Get VDF formatted data for the specified key
解析器 Parser | 解析速度 Parse Speed | #base支持 #base Support | 备注 Notes |
---|---|---|---|
vdf-faster | 19.054ms | ✅ 完整支持 Complete | 性能优化,完整功能 Performance optimized, full features |
fast-vdf | 13.438ms | ❌ 不支持 Not supported | 性能最快但功能受限 Fastest but limited features |
vdferparser | 34.062ms | ❌ 解析错误 Parse error | - |
vdf-reader | 39.303ms | ⚠️ 部分支持 Partial | #base作为普通键处理 #base treated as regular key |
vdf-parser | 42.146ms | ❌ 解析错误 Parse error | - |
vdf-extra | 50.318ms | ✅ 支持 Supported | 不支持大文件 Doesn't support large files |
vdfjs | 87.78ms | ❌ 不支持 Not supported | - |
MIT
No vulnerabilities found.