Add some commands to make it easier to import/export single documents to files, either as JSON (including the document metadata) or just as the document content.
// new commands
earthstar document
earthstar content [--binary]
// new flags to existing command
earthstar set --fromFile <filename> [--binary]
Usage
// print out a whole document as JSON
earthstar document <dbFilename> <path>
// prints out just document.content
earthstar content <dbFilename> <path>
// redirect it to a file, to export the data out of earthstar
earthstar content <dbFilename> <path> > myfile
// read data from a file to use as the document's content
earthstar set <dbFilename> <authorFile> <path> --fromFile <filename>
// new option --binary means treat the file as binary instead of utf-8
// which means it needs to be encoded/decoded to base64 for storage in Earthstar
earthstar content <dbFilename> <path> --binary
earthstar set <dbFilename> <authorFile> <path> --fromFile <filename> --binary
Or maybe instead of --fromFile, it could try to read from stdin so you could do earthstar set db.sqlite author.json /path < myfile
Add some commands to make it easier to import/export single documents to files, either as JSON (including the document metadata) or just as the document content.
Usage
Or maybe instead of
--fromFile
, it could try to read from stdin so you could doearthstar set db.sqlite author.json /path < myfile