1.1.0 • Published 2 years ago

easy-backuper v1.1.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 years ago

Super Easy backuper

Usage:

npm i easy-backuper
// script.js

import {FolderBackup} from "easy-backuper";

// Specify project folder you want to backup, and path to backup storage
let backup = new FolderBackup('./example/project', './example/backups') // IN, OUT
await backup.daily(5) // Last 5 days will be saved
await backup.weekly(3) // Last 3 week will be saved
await backup.monthly(3) // Last 3 months will be saved
await backup.annually(2) // Last 2 years will be saved

// You can use them without "await".

Now you can add this script to your cron as cron job for every day.

node script.js

Extended options:

let backup = new FolderBackup('./example/project', './example/backups')
backup.today = new Date("2020-06-21"); // Change backup date
backup.filter = [
    '**', // Add all files to filter
    '!**/*.jar', // Exclude .jar files from filter
    '!**/*.bin', // Exclude .bin files from filter
    // It also supports patterns etc.
    /^(?!.*\.log)/, // Exclude .log files from filter
]
await backup.daily(2) // Last 2 days will be saved