1.0.1 • Published 7 years ago

@ehf/file v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

ehf-file

Reads and writes files.

csv(path | paths)

Pass 1 or more paths as args to read csv files. Returns JSON (or array of JSON results), wrapped in a promise.

json(path)

Pass a path to read in a json file, wrapped in a promise.

text(path)

Pass a path to read in a text file, wrapped in a promise.

read(path | paths)

Pass 1 or more paths as args to read in any number of files. Attempts to parse CSV/JSON based on extension. Returns array of JSON results, wrapped in a promise.

write(path, data, opts)

Write data to path. opts can include format: 'json'|'csv'|'txt'.