Skip to content

fetsorn/panrec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvs-nodejs

csvs-nodejs - read and write csvs database from command-line.

Developer Information and Tools

Install dependencies

You’ll need to install nodejs >= 18.15.0. We use yarn but npm should work too. Assuming that’s done, run `yarn` with no args:

yarn

Run with node

node src/index.js

Documentation

Structure of the repo

index.js - main cli setup

parse - streams that parse various format into json entries

build - streams that write json entries to various formats

utils - common utility code for streams

Usage

Usage: csvs [options]

Manage csvs databases.

Options:
  -v, --version               output the version number
  -i, --source-path <string>  Path to source (default: "/Users/fetsorn/mm/codes/csvs-nodejs")
  -o, --target-path <string>  Path to target
  -t, --target-type <string>  Type of target (default: "json")
  -q, --query <string>        Search string (default: "?")
  --gc                        Collect dangling database nodes
  -h, --help                  display help for command
# output as json
node src/index.js -i /path/to/csvs-database

# query all entries that have a filename starting with "2005"
node src/index.js -i /path/to/csvs-database -q "?filename=2005.*"

# query all entries of type filename
node src/index.js -i /path/to/csvs-database -q "?_=filename"

# write entries from source to target database
node src/index.js -i /path/to/source-database -o /path/to/target-database

# cache file metadata from source folder to target database
node src/index.js -i /path/to/source-folder -o /path/to/target-database