Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including dropbox-symlink with all npm packages installed. Try it out:

var dropboxSymlink = require("dropbox-symlink")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

dropbox-symlink v0.0.3

Symlink files to/from local dropbox folder

dropbox-symlink

Build Status

Experimenting with dropbox-as-a-backend

Symlink files to/from local dropbox folder (Supports only Mac And Linux)

Install

$ npm install dropbox-symlink --save

Usage

var filePath = '/home/ewnd9/d2';

var dropbox = require('dropbox-symlink')(filePath, {
  onLinkFrom: function(fromFile, toFile) {
    // default: console.log('[Dropbox] symlinked file ' + fromFile + ' to ' + toFile)
  },
  onLinkTo: function(fromFile, toFile) {
    // default: console.log('[Dropbox] symlinked file from ' + fromFile + ' to ' + toFile)
  }
});

dropbox.exists; // is default dropbox folder finded in system
dropbox.fileExists; // is file already in dropbox folder
dropbox.dropboxFile; // absolute path to dropbox symlink

if (dropbox.exists) {
  if (!dropbox.fileExists && fs.existsSync(filePath)) {
    dropbox.linkToDropbox();
  } else if (dropbox.fileExists && !fs.existsSync(filePath)) {
    dropbox.linkFromDropbox();
  }
}

TODO

  • [ ] check directory linking support

License

MIT © ewnd9

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free