Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Storage API usage example #65

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Storage API usage example #65

wants to merge 2 commits into from

Conversation

zone117x
Copy link
Collaborator

@zone117x zone117x commented Aug 25, 2019

Creating this PR primarily as an example of using the blockstack.js storage APIs, and the Web File APIs in PR hirosystems/stacks.js#693

The following storage functions are used: listFiles, getFile, putFile, deleteFile. All are used with encryption enabled. putFile is used with a File object from both a <input type="file"> element and the Web Drag and Drop API.

A built and working version of this app can be used at https://zone117x.github.io/blockstack-file-api-demo/dist/index.html

Tested on MacOS with Chrome, Firefox, Safari; and on Windows with Edge.

Image file types are used and displayed as a decent visual indicator for seeing where something might be broken, especially since they tend to be larger file sizes.


Regarding actually merging this PR into the app-generator --
Seems like it would be useful for storage API examples to be setup, but this example usage output is pretty opinionated as an app scaffold. Perhaps it should be its own generator -- something like yo blockstack:storage?

If not, then this PR can just serve as example usage for the reference PR, and possibly docs if we need any. The source can remain at my demo app repo https://github.com/zone117x/blockstack-file-api-demo

@moxiegirl
Copy link
Contributor

moxiegirl commented Aug 26, 2019

@zone117x Why do we need this? It is adding complexity to the generated app. If we do this we are adding default material that has to be removed from the tutorials --- just extra confusing work.

If we want to add samples, we should add them to a sample not the generator.

@zone117x
Copy link
Collaborator Author

@moxiegirl

Why do we need this?

Stated in the PR description -- I think usage of our storage functions in an app generator may be useful for devs.

It is adding complexity to the generated app.

I agree about possibly too much complexity, and had some questions & suggestions in the PR description for discussion.

If we do this we are adding default material that has to be removed from the tutorials

I'm not following here -- I don't think adding features to the app generator necessitates removing material from the tutorials?

If we want to add samples, we should add them to a sample not the generator.

This PR is based off a sample (linked in the description), is there an appropriate sample repo I should be using or what do you mean?

@moxiegirl
Copy link
Contributor

If we do this we are adding default material that has to be removed from the tutorials

I'm not following here -- I don't think to add features to the app generator necessitates removing material from the tutorials?

Most hello-worlds don't demo everything a platform can do. This PR adds over 1000 lines of code. Which increases substantially the basic hello world length.

If we include storage as well, depending on how and where it is added, we will need to change tutorials that are existing to move or remove the redundant storage functions you want to add. The directly impacted sample applications are:

  • Hello world
  • Storage tutorial
  • Hello Hub choice

My point is, the app generator functions also as a Hello World. Changing that such that the code involved is longer and more involved should be considered as how it impacts the user experience and education; not simply because we can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants