dropbox-symlink

0.0.3 • Public • Published

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

Dependencies (2)

Dev Dependencies (4)

Package Sidebar

Install

npm i dropbox-symlink

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • ewnd9