Node.js module for real time backup of files and directories.
This is a simple script to backup a directory to a sd card. Only works on Linux.
Version of node.js required: 10.0.0
const RealTimeBackup = require('real-time-backup');
// Create a new instance of RealTimeBackup
const backup = RealTimeBackup().create(
{
dirMount: "/media/dir",
partitionName: "/dev/dir",
projectDir: "/home/user/project",
sdCardName: "sdName",
activeLog: true
}
);
// Start backup
backup.start();
-
Start backup
-
return: void
backup.start();
-
Set the copy to backup => arg: true or false
-
return: void
backup.setCopyToBackup(true);
-
Check if the partition is mounted
-
return: boolean (true or false)
backup.isMounted();
-
Subscribe to the event isMounted
-
return: void
backup.subscribeIsMounted((isMounted) => { console.log(isMounted); });
-
Unsubscribe to the event isMounted
-
return: void
backup.unSubscribeIsMounted();