Skip to content

lurchmath/cloud-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Storage Module

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.

Usage

  1. Import the relevant files into your page. You need at least the main file, cloud-storage.js. You can use a CDN, like so:
<script src='https://cdn.jsdelivr.net/gh/lurchmath/[email protected]/release/cloud-storage.js'></script>
  1. Import whatever back-ends you want to use for storage. Here are the two that are currently supported.
<!-- 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>
  1. If you imported the Dropbox backend, then you need to take these additional steps:
  2. Write scripts that make calls to openFile() or saveFile() when you want them to. For help in figuring out how to do so:

Status

Right now three data storage backends are supported.

  1. 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!

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

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

License

LGPLv3