Skip to content

Commit 4865aa3

Browse files
authored
feat(standalone): Support .tsv (#48)
1 parent cee1ac8 commit 4865aa3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
id="dropzone"
6767
class="rounded-lg h-48 border-2 border-gray-200 border-dashed text-gray-600 flex flex-col justify-center items-center"
6868
>
69-
<input type="file" class="absolute w-full h-full opacity-0" accept=".csv,.parquet"/>
69+
<input type="file" class="absolute w-full h-full opacity-0" accept=".csv,.parquet,.tsv,.json"/>
7070
<img src="./assets/logo-color.svg" class="h-20 w-20" />
7171
<div id="message" class="text-center">
7272
Drag & Drop a <strong>.csv</strong> or <strong>.parquet</strong>

lib/demo.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ async function main() {
6868
if (source) {
6969
exec = source.endsWith(".csv")
7070
? msql.loadCSV(tableName, source, { replace: true })
71+
: source.endsWith(".tsv")
72+
? msql.loadCSV(tableName, source, { replace: true, delim: "\t" })
7173
: source.endsWith(".json")
7274
? msql.loadJSON(tableName, source, { replace: true })
7375
: msql.loadParquet(tableName, source, { replace: true });
@@ -79,6 +81,12 @@ async function main() {
7981
} else if (file.name.endsWith(".json")) {
8082
await db.registerFileText(file.name, await file.text());
8183
exec = msql.loadJSON(tableName, file.name, { replace: true });
84+
} else if (file.name.endsWith(".tsv")) {
85+
await db.registerFileText(file.name, await file.text());
86+
exec = msql.loadCSV(tableName, file.name, {
87+
replace: true,
88+
delim: "\t",
89+
});
8290
} else {
8391
assert(file.name.endsWith(".parquet"));
8492
await db.registerFileBuffer(

0 commit comments

Comments
 (0)