This module creates a very small API for interacting with cloud storage providers in a way that’s simple, from the point of view of a developer writing an editor application. That is, if all you need to support are the standard dialogs for “File > Open” and “File > Save as…” and “File > Save” then this is the module for you. If you have more advanced needs, you will need a different toolkit.
cloud-storage.js
. You can use a CDN, like so:
<script src='https://cdn.jsdelivr.net/gh/lurchmath/cloud-storage@v2.1/release/cloud-storage.js'></script>
<!-- In-browser storage (yes, OK, that's not cloud storage): -->
<script src='https://cdn.jsdelivr.net/gh/lurchmath/cloud-storage@v2/release/localstorage-backend.js'></script>
<!-- Dropbox storage, which requires two files: -->
<script src='https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js'></script>
<script src='https://cdn.jsdelivr.net/gh/lurchmath/cloud-storage@v2/release/dropbox-backend.js'></script>
openFile()
or saveFile()
when you
want them to. For help in figuring out how to do so:
cloud-storage.js
,
also liberally commented. See openFile()
and saveFile()
about
half way through.Right now three data storage backends are supported.
Dropbox (this is the only one that’s actually cloud storage)
Its source code is here.
To add a new backend, mimic the work done in that file. Cloud storage providers other than Dropbox are very welcome!
A LocalStorage-based filesystem that does persist across page loads, but is only one flat folder (no ability to create subfolders) due to the simple API exposed by this library. (This module does not expose folder manipulation tools, because cloud storage platforms already do so. Consequently, this non-cloud-storage-based filesystem has no folders.)
Its source code is here.
A JSON-based filesystem that is of little use in applications (because it exists only in memory while the page is loaded, and thus is not persistent) but is a nice example for developers and testers.
Its source code is inside the cloud-storage.js
file.
Desired future enhancements appear on the to-do list.