Dropbox backup directory
A NodeJS tool to
- zip a directory and create backup onto Dropbox,
- list backups,
- download a backup
- or download and unzip a backup.
install @landmineaknpm2/labore-quidem-accusamus
npm install @landmineaknpm2/labore-quidem-accusamus@latest --global
set your preferences
A dropbox application (dropboxAppKey
,dropboxAppSecret
), and long-lived refresh-token (dropboxRefreshToken
) are required.
NB: in order to understand how-to get a `refresh-token, cf dropbox-refresh-token
The old-long-lived access-token (dropboxToken
) are always supported but this method is deprecated and will be removed in futur release.
@landmineaknpm2/labore-quidem-accusamus setup
(first time only) create a @landmineaknpm2/labore-quidem-accusamus config file ~/.@landmineaknpm2/labore-quidem-accusamus
To remove this setup
@landmineaknpm2/labore-quidem-accusamus unlink
NB: you could create other custom @landmineaknpm2/labore-quidem-accusamus config files, and choose custom @landmineaknpm2/labore-quidem-accusamus config file by using DBD_CONFIG_FILE
env.
@landmineaknpm2/labore-quidem-accusamus
show actions
@landmineaknpm2/labore-quidem-accusamus backup <localDirectory> [<myBackup.zip>]
create a remote zip backup from local directory
Example: zip local directory ../tmp/backup/myDir
then upload as dropbox backup /backup/biolo.zip
@landmineaknpm2/labore-quidem-accusamus backup ../tmp/backup/myDir biolo.zip
This action will success if the target dropbox already exists with the same zip file.
This action will fail if a different target dropbox already exists (use forceBackup
to override it).
backup
is the default dropbox backup target directory and may be changed using options.
@landmineaknpm2/labore-quidem-accusamus forceBackup <localDirectory> [<myBackup.zip>]
@landmineaknpm2/labore-quidem-accusamus list
DBD_CONFIG_FILE=./tmp/myDrobadiConfig @landmineaknpm2/labore-quidem-accusamus list
list remote backups
@landmineaknpm2/labore-quidem-accusamus download <myBackup.zip> [<localFile.zip>]
download a remote backup into local file
Example: download dropbox file /backup/biolo.zip
as local file ./biolo.zip
@landmineaknpm2/labore-quidem-accusamus download biolo.zip
Example: download dropbox file /backup/biolo.zip
as local file /tmp/ddd.zip
@landmineaknpm2/labore-quidem-accusamus download biolo.zip /tmp/ddd.zip
@landmineaknpm2/labore-quidem-accusamus downloadAndUnzip <myBackup.zip> [</local/path>]
download a remote backup and unzip it into local directory
Example: download dropbox file /backup/biolo.zip
and unzip it into local directory ./biolo
@landmineaknpm2/labore-quidem-accusamus downloadAndUnzip biolo.zip ./biolo
Drobadi options are
-
dropboxAppKey
(orDBD_DROPBOX_APP_KEY
env. Default:null
. Required) : dropbox application key. -
dropboxAppSecret
(orDBD_DROPBOX_APP_SECRET
env. Default:null
. Required) : dropbox application secret. -
dropboxRefreshToken
(orDBD_DROPBOX_REFRESH_TOKEN
. Default:null
. env. Required) : dropbox application refresh-token. -
path
(orDBD_PATH
env. Default:backup
) : dropbox target directory that receive backup files. -
overrideTargetBackup
(orDBD_OVERRIDE_TARGET_BACKUP
env. Default:false
) : override target backup file.
Deprecated option:
-
dropboxToken
(orDBD_DROPBOX_TOKEN
env. Default:null
. DEPRECATED) : dropbox access-token value, -
dropboxTokenDisableWarning
(orDBD_DROPBOX_TOKEN_DISABLE_WARNING
env. Default:false
.*) : change-it to disable warning log.
Note that @landmineaknpm2/labore-quidem-accusamus setup
help you to create a ~/.@landmineaknpm2/labore-quidem-accusamus
config file.
DOptions precedence: options object, or env value or config file or default value.
You have to import as dependency
npm install @landmineaknpm2/labore-quidem-accusamus
import {Drobadi, DOptions} from "@landmineaknpm2/labore-quidem-accusamus";
const dOptions = new DOptions({
"dropboxToken": 'My dropbox token is a secret',
"path": "from-@landmineaknpm2/labore-quidem-accusamus",
"overrideTargetBackup": true
});
let @landmineaknpm2/labore-quidem-accusamus = new Drobadi();
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.backup(dOptions, "./myData/", "dataBack.zip")
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.list(dOptions);
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.download(dOptions, "dataBack.zip")
var promiseResult = @landmineaknpm2/labore-quidem-accusamus.download(dOptions, "dataBack.zip", "/home/user/incomming/restored.zip")
var promiseResult = @landmineaknpm2/labore-quidem-accusamus.downloadAndUnzip(dOptions, "dataBack.zip", "/tmp/restoreHere")
NB: you could also have a look at tests : @landmineaknpm2/labore-quidem-accusamus.test.js
badge | name | description |
---|---|---|
Github actions | Continuous tests. | |
Github actions | Continuous vulnerability audit. | |
Houndci | JavaScript automated review (configured by .hound.yml ) |