blockstack-app-generator icon indicating copy to clipboard operation
blockstack-app-generator copied to clipboard

Storage API usage example

Open zone117x opened this issue 6 years ago • 3 comments

Creating this PR primarily as an example of using the blockstack.js storage APIs, and the Web File APIs in PR https://github.com/blockstack/blockstack.js/pull/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

zone117x avatar Aug 25 '19 07:08 zone117x

@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.

moxiegirl avatar Aug 26 '19 17:08 moxiegirl

@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?

zone117x avatar Aug 27 '19 00:08 zone117x

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.

moxiegirl avatar Aug 29 '19 19:08 moxiegirl