-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor download script to use new backup download manifest
New script pulls the manifest and downloads the compressed versions, then uncompresses them and saves them to the data dir. This makes it much quicker and easier to sync the latest database to development systems.
- Loading branch information
1 parent
ea8f84e
commit c3ad814
Showing
4 changed files
with
67 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require('fs') | ||
const crypto = require('crypto') | ||
|
||
module.exports = async (pathToFile, algorithm = 'sha256') => { | ||
return await new Promise((resolve, reject) => { | ||
const hash = crypto.createHash(algorithm) | ||
const rs = fs.createReadStream(pathToFile) | ||
rs.on('error', reject) | ||
rs.on('data', chunk => hash.update(chunk)) | ||
rs.on('end', () => resolve(hash.digest('hex'))) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters