dropbox-symlink

Symlink files to/from local dropbox folder

Usage no npm install needed!

<script type="module">
  import dropboxSymlink from 'https://cdn.skypack.dev/dropbox-symlink';
</script>

README

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