@landmineaknpm2/labore-quidem-accusamus
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.
![NPM](https://nodei.co/npm/@landmineaknpm2/labore-quidem-accusamus.png?compact=true)
Command line usage
Setup
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.
Show help
@landmineaknpm2/labore-quidem-accusamus
show actions
Create a backup
@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.
Create or override a backup
@landmineaknpm2/labore-quidem-accusamus forceBackup <localDirectory> [<myBackup.zip>]
List backups
@landmineaknpm2/labore-quidem-accusamus list
DBD_CONFIG_FILE=./tmp/myDrobadiConfig @landmineaknpm2/labore-quidem-accusamus list
list remote backups
Download a backup
@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
Download and unzip a backup
@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
DOptions
Drobadi options are
dropboxAppKey
(or DBD_DROPBOX_APP_KEY
env. Default: null
. Required) : dropbox application key.dropboxAppSecret
(or DBD_DROPBOX_APP_SECRET
env. Default: null
. Required) : dropbox application secret.dropboxRefreshToken
(or DBD_DROPBOX_REFRESH_TOKEN
. Default: null
. env. Required) : dropbox application refresh-token.path
(or DBD_PATH
env. Default: backup
) : dropbox target directory that receive backup files.overrideTargetBackup
(or DBD_OVERRIDE_TARGET_BACKUP
env. Default: false
) : override target backup file.
Deprecated option:
dropboxToken
(or DBD_DROPBOX_TOKEN
env. Default: null
. DEPRECATED) : dropbox access-token value,dropboxTokenDisableWarning
(or DBD_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.
Library use
Install dependency
You have to import as dependency
npm install @landmineaknpm2/labore-quidem-accusamus
Define the requirements, example:
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();
create a remote backup from local directory
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.backup(dOptions, "./myData/", "dataBack.zip")
list remote backups
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.list(dOptions);
Restore remote backup in current directory
let promiseResult = @landmineaknpm2/labore-quidem-accusamus.download(dOptions, "dataBack.zip")
Restore remote backup in a given local destination
var promiseResult = @landmineaknpm2/labore-quidem-accusamus.download(dOptions, "dataBack.zip", "/home/user/incomming/restored.zip")
Restore remote backup and unzip it in a given local directory
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
How to contribute
cf contributing guide
Services or activated bots
badge | name | description |
---|
![CI/CD](https://github.com/landmineaknpm2/labore-quidem-accusamus/workflows/@landmineaknpm2/labore-quidem-accusamus-ci/badge.svg) | Github actions | Continuous tests. |
![Audit](https://github.com/landmineaknpm2/labore-quidem-accusamus/actions/workflows/audit.yml/badge.svg) | Github actions | Continuous vulnerability audit. |
![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg) | Houndci | JavaScript automated review (configured by .hound.yml ) |