1.0.0 • Published 10 years ago
dir-dat v1.0.0
dir-dat
Import a directory or zipfile into dat. Uses the filename as the dataset name unless otherwise specified. Prompts you along the way if you want. Cool.
$ npm install -g dir-dat
$ dir-dat --help
Usage: dir-dat <path> [options]
--dat=<path> The path to the dat. Default: '.' --exclude/e Exclude given directories
--exclude/e Exclude given directories.
--no-prompt Doesn't prompt. Will import EVERYTHING!
If the path points to a file (.e.g, tar
or zip
), dit-dir will try to decompress it and import the files.
Example
$ dir-dat ./data -e tests/
data/README.md as [README.md]?: n
data/a.csv as [a.csv]?: y
Success! Imported to dataset a.csv
data/adir/c.csv as [c.csv]?: my-dataset
Success! Imported to dataset my-dataset
...
All done.
JS
var dirdat = require('dir-dat')
dirdat(dir, opts, function (err, dataset, next) {
if (!next) return console.log('All done.')
if (err) {
console.log('skipped', dataset.path)
return next()
}
console.log('Imported', dataset.path, 'as', dataset.name)
next()
})
Options
datPath
: where the dat lives. Will create a dat if one doesn't already exist.
db
: the dat database. otherwise, creates one at datPath
prompt
: will not prompt the user. tries to import EVERYTHING!
exclude
: array of directory names to exclude (relative to dir
).
License
BSD-2
1.0.0
10 years ago