csvql-query 1.5.12 → 1.6.0

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 ADDED
@@ -0,0 +1,78 @@
1
+ # csvql-query
2
+
3
+ Fast SQL queries on CSV files from Node.js — powered by a Zig/SIMD engine via N-API.
4
+
5
+ The engine streams through the file instead of loading it into memory, so RAM stays ~5 MB regardless of file size. Prebuilt native binaries ship for macOS (arm64/x64), Linux (x64/arm64), and Windows (x64) — no compiler needed.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install csvql-query
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const csvql = require('csvql-query');
17
+
18
+ // SQL query → array of objects
19
+ const rows = csvql.query("SELECT name, salary FROM 'employees.csv' WHERE salary > 100000");
20
+
21
+ // Aggregates + GROUP BY
22
+ const byCity = csvql.query(
23
+ "SELECT city, COUNT(*) AS n, AVG(salary) AS avg FROM 'employees.csv' GROUP BY city ORDER BY avg DESC"
24
+ );
25
+
26
+ // JOIN two files
27
+ const joined = csvql.query(
28
+ "SELECT e.name, d.name AS dept FROM 'employees.csv' e JOIN 'departments.csv' d ON e.dept_id = d.id"
29
+ );
30
+
31
+ // Return CSV text instead of objects
32
+ const csv = csvql.queryCsv("SELECT city, COUNT(*) FROM 'data.csv' GROUP BY city");
33
+ ```
34
+
35
+ ### TSV and other delimiters
36
+
37
+ ```js
38
+ csvql.query("SELECT * FROM 'data.tsv' WHERE score > 90", { delimiter: '\t' });
39
+ ```
40
+
41
+ ### Skip comments / blank lines
42
+
43
+ ```js
44
+ csvql.query("SELECT * FROM 'data.csv'", { comment: '#', skipEmptyLines: true });
45
+ ```
46
+
47
+ ## No-SQL API
48
+
49
+ `find()` builds the SQL for you — no SQL knowledge needed:
50
+
51
+ ```js
52
+ csvql.find('employees.csv', {
53
+ columns: ['name', 'city', 'salary'],
54
+ where: 'salary>100000 AND department=Engineering',
55
+ orderBy: 'salary:desc',
56
+ limit: 10,
57
+ });
58
+ ```
59
+
60
+ Operators in `where`: `= != > >= < <=`, combined with `AND` / `OR`. Values are auto-quoted (numbers stay unquoted). For aggregates (COUNT, SUM, AVG, GROUP BY) use `query()`.
61
+
62
+ ## API
63
+
64
+ | Function | Returns | Notes |
65
+ |----------|---------|-------|
66
+ | `query(sql, opts?)` | `Object[]` | Full SQL. File paths are single-quoted in FROM/JOIN. |
67
+ | `queryCsv(sql, opts?)` | `string` | Same as `query` but returns CSV text. |
68
+ | `find(file, opts?)` | `Object[]` | Simple filter/sort/limit without writing SQL. |
69
+
70
+ `opts`: `{ delimiter, comment, skipEmptyLines }`. TypeScript declarations are bundled.
71
+
72
+ ## Supported SQL
73
+
74
+ `SELECT`, `WHERE`, `GROUP BY`, `ORDER BY`, `LIMIT`, `JOIN`, `DISTINCT`, `LIKE`, and `COUNT` / `SUM` / `AVG` / `MIN` / `MAX`.
75
+
76
+ ## License
77
+
78
+ MIT · [github.com/melihbirim/csvql](https://github.com/melihbirim/csvql)
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "csvql-query",
3
- "version": "1.5.12",
3
+ "version": "1.6.0",
4
4
  "description": "Fast SQL queries on CSV files — Zig/SIMD engine via N-API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",