How to use the filer.FileSystem function in filer

To help you get started, we’ve selected a few filer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github humphd / nohost / shims / nohost.js View on Github external
function init() {
    // Our require setup is still alive in the DOM, so we can get at Filer
    fs = new Filer.FileSystem({
      provider: new Filer.FileSystem.providers.Fallback()
    });

    rewireScript();
    rewireImage();
    rewireXHR();
    startWatchers();
    cleanEnv();
  }
github mozilla / makedrive / server / routes.js View on Github external
get: function( req, res ) {
    var user = req.session.user;
    var path = req.params[0];
    var info = getFileInfo(path);

    var fs = new Filer.FileSystem({provider: new S3Provider({keyPrefix: user.username, name: user.username, bucket: "", key: "", secret: ""})});
    fs.readFile("/" + path, info.encoding, function(err, data) {
      if(err) {
        if(err.code === "ENOENT") {
          res.send(404);
          return;
        } else {
          res.send(500, "Unable to read file" + err);
        }
      }
      res.writeHead(200, "OK", {'Content-Type': info.mime});
      res.write(data);
      res.end()
    });
  },
  healthcheck: function( req, res ) {
github mozilla / makedrive / server / routes.js View on Github external
clear: function(req, res) {
    var user = req.session.user;
    var fs = new Filer.FileSystem({flags: "FORMAT", provider: new S3Provider({keyPrefix: "dave", name: "dave", bucket: "", key: "", secret: ""})}, function(err){
      if(err) {
        res.send(500, {error: e});
        return;
      }
      res.send(200);

    });
  },
};