Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
MakeDrive Client API Example
// MakeDrive API - https://github.com/mozilla/makedrive
var MakeDrive = require('./path/to/makedrive.js');
// fs API - https://github.com/js-platform/filer#filer
var fs = MakeDrive.fs();
// Use fs right away, with or without network
fs.mkdir('/project', function(err) {
if(err) throw err;
fs.writeFile('/project/index.html', '<p>Hello World!</p>', function(err) {
if(err) throw err;
// /project/index.html is now written to disk
});
});
// When you want to sync, get the fs' sync object
var sync = fs.sync;
// Listen for events you care about
sync.on('error', function(err) {
// There was an error during syncing
});
sync.on('connected', function() {
// Connected to sync server
});
sync.on('disconnected', function() {
// Disconnected from sync server
});
sync.on('syncing', function() {
// Syncing with server
});
sync.on('completed', function() {
// Completed syncing with server
});
// Connect to the server
sync.connect('ws://server-url.com');
// [Optional, if in manual mode] Request an upstream sync with the server
sync.request();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.