Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import/export a single earthstar document to a file #2

Open
cinnamon-bun opened this issue Jun 4, 2020 · 0 comments
Open

Import/export a single earthstar document to a file #2

cinnamon-bun opened this issue Jun 4, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@cinnamon-bun
Copy link
Member

cinnamon-bun commented Jun 4, 2020

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

@cinnamon-bun cinnamon-bun added the enhancement New feature or request label Jun 4, 2020
@cinnamon-bun cinnamon-bun changed the title Set a key from the contents of a file Import/export a single earthstar key to a file Jun 4, 2020
@cinnamon-bun cinnamon-bun added the good first issue Good for newcomers label Jun 4, 2020
@cinnamon-bun cinnamon-bun changed the title Import/export a single earthstar key to a file Import/export a single earthstar document to a file Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant