With the fileWrite, you can send any function in the options.
The function must have the fields path and filecontents.
That's to save the file in anywhere you want like the cloud.
For example:
function saveFileS3 (path, content) {
const params = {
Bucket: s3Bucket,
Key: (new Date()).toISOString() + (!path.startsWith('/') && '/' || '0') + path,
ContentType: 'application/json',
Body: content
}
@KRVJKvothe thanks so much for the PR! The idea is great, something that should have been in a long time ago. I've added a few review requests but otherwise it looks great!
With the fileWrite, you can send any function in the options. The function must have the fields path and filecontents. That's to save the file in anywhere you want like the cloud. For example: function saveFileS3 (path, content) { const params = { Bucket: s3Bucket, Key: (new Date()).toISOString() + (!path.startsWith('/') && '/' || '0') + path, ContentType: 'application/json', Body: content }
s3.putObject( params, (err, data) => { if (err) { console.log(err) } else { console.log('Guardado: ' + path) } }) }
To save in an AWS S3 Bucket. so you send the function in the fileWrite in options, like:
firestore({ accountCredentials: { project_id: CONFIG.GOOGLE_PROJECT_ID, private_key: CONFIG.GOOGLE_PRIVATE_KEY, client_email: CONFIG.GOOGLE_CLIENT_EMAIL }, backupPath: '', fileWrite: saveFileS3 }).then(......)
Thank's you for the firestore-backup.