convert-buddy-js 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -84,6 +84,7 @@ Use streaming inputs to keep detection fast on large files.
|
|
|
84
84
|
import {
|
|
85
85
|
detectFormat,
|
|
86
86
|
detectCsvFieldsAndDelimiter,
|
|
87
|
+
detectXmlElements,
|
|
87
88
|
} from "convert-buddy-js";
|
|
88
89
|
|
|
89
90
|
const fileStream = (await fetch("/data")).body!;
|
|
@@ -91,10 +92,17 @@ const fileStream = (await fetch("/data")).body!;
|
|
|
91
92
|
const format = await detectFormat(fileStream, { maxBytes: 256 * 1024 });
|
|
92
93
|
console.log(format); // "csv" | "json" | "ndjson" | "xml" | "unknown"
|
|
93
94
|
|
|
95
|
+
// For CSV files, detect delimiter and field names
|
|
94
96
|
const csvInfo = await detectCsvFieldsAndDelimiter(fileStream);
|
|
95
97
|
if (csvInfo) {
|
|
96
|
-
console.log(csvInfo.delimiter);
|
|
97
|
-
console.log(csvInfo.fields);
|
|
98
|
+
console.log(csvInfo.delimiter); // ","
|
|
99
|
+
console.log(csvInfo.fields); // ["name", "age", "city"]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// For XML files, detect element names
|
|
103
|
+
const xmlInfo = await detectXmlElements(fileStream);
|
|
104
|
+
if (xmlInfo) {
|
|
105
|
+
console.log(xmlInfo.elements); // ["root", "record", "field", ...]
|
|
98
106
|
}
|
|
99
107
|
```
|
|
100
108
|
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "convert-buddy-js",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "TypeScript wrapper for convert-buddy (Rust/WASM core)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"bench:competitors-comprehensive": "npm run build && node ./dist/bench/runner-competitors-comprehensive.js",
|
|
43
43
|
"bench:all": "npm run bench:single-thread && npm run bench:multi-thread && npm run bench:compare && npm run bench:competitors-comprehensive",
|
|
44
44
|
"lint": "node ./scripts/lint-placeholder.mjs",
|
|
45
|
-
"
|
|
45
|
+
"test:rust": "cargo test --lib --manifest-path ../../crates/convert-buddy/Cargo.toml --release",
|
|
46
|
+
"prepack": "npm run test:rust && npm run build && npm run check:wasm"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@types/node": "^25.0.3",
|