all repos — dbee @ b22378184073ce48c49767ed1031a99e1e83166c

Move PostgreSQL backups using S3

handlers/db/list.js (view raw)

 1const chalk = require("chalk");
 2const S3Client = require("../../libs/s3/client");
 3const getS3Config = require("../../libs/s3/getConfig");
 4
 5const list = async ({ s3Name }) => {
 6  const s3Config = getS3Config(s3Name);
 7  const files = await S3Client(s3Config).list();
 8  const formatedList = files.map(file => `- ${file.name}`);
 9
10  console.log(`Available dumps on ${s3Config.name}:\n`);
11  console.log(chalk.yellowBright(`${formatedList.join("\n")}\n`));
12};
13
14module.exports = list;