litefilesystem.js

the front-end and back-end library that allows javascript apps to store resources (images, text-files, binaries) in the server. It comes with its own users and units system that allow every user to partition its own space and share it among other users.

 

Some of the features:

  • REST HTTP API for storing, listing, moving, updating or deleting files.
  • Basic users (register, login, delete, administration )
  • Independent file tree per user
  • Units, users can have several units to store files and share with other users
  • Files can have thumbnail image and metadata

Usage

Once installed you can include the litefileserver.js script in your project you must first login:

var lfs = LFS.setup("myhost", onReady );
var session = null;

//check to see if the server is available
function onReady()
{
   LFS.login( username, password, onLogin );
}

function onLogin( my_session, err )
{
   if(!my_session)
      throw("error login in:", err);
   session = my_session;
}

Once logged you can fetch for files and folders using the session:

session.getUnitsAndFolders( function(units) {
  //units contain info about every unit and which folders it has
});

session.getFiles( unit_id, folder, function( files ) {
  //info about the files in that folder
});

Check the LFS.Session class for more info about all the actions you can perform (create folders, units, give privileges, upload files, etc).

Also check the demo in the src folder to see an usage of the system.

litefilesystem.js
Authorization