This commit is contained in:
Caleb Gosiak 2021-09-30 15:52:51 -05:00
parent d9e985924e
commit 2377d067bc
4 changed files with 31 additions and 46 deletions

22
dist/restore/index.js vendored
View file

@ -43330,20 +43330,14 @@ class CacheService {
uploadToS3(key, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const client = new aws_sdk_1.S3();
// Read in the file, convert it to base64, store to S3
fs_1.default.readFile(archivePath, (err, data) => {
if (err) {
throw err;
}
const base64data = data.toString("base64");
client
.putObject({
Bucket: this._bucket,
Key: key,
Body: base64data
})
.send();
});
const data = fs_1.default.readFileSync(archivePath).toString("base64");
return client
.putObject({
Bucket: this._bucket,
Key: key,
Body: data
})
.promise();
});
}
}

22
dist/save/index.js vendored
View file

@ -43330,20 +43330,14 @@ class CacheService {
uploadToS3(key, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const client = new aws_sdk_1.S3();
// Read in the file, convert it to base64, store to S3
fs_1.default.readFile(archivePath, (err, data) => {
if (err) {
throw err;
}
const base64data = data.toString("base64");
client
.putObject({
Bucket: this._bucket,
Key: key,
Body: base64data
})
.send();
});
const data = fs_1.default.readFileSync(archivePath).toString("base64");
return client
.putObject({
Bucket: this._bucket,
Key: key,
Body: data
})
.promise();
});
}
}