1import * as _ from 'lodash-es' 13export const creds = () => { 14 const {consoleHostname, accessKeyId, secretAccessKey} = minioKubeCtx.getStore()! 16 ${consoleHostname} ${accessKeyId} / ${secretAccessKey} 20export const ls = async () => { 21 const {bucket_name} = minioKubeCtx.getStore()! 23 const topDirs = _.chain(allPaths).map((path) => _.split(path, '/')[0]).uniq().value() 24 // console.log({bucket_name}); process.exit() 28export const deldir = async () => { 29 const {bucket_name} = minioKubeCtx.getStore()! 30 const dirToDel = 'og4db' 32 const pathsToDelete = _.filter(allPaths, (path) => _.startsWith(path, `${dirToDel}/`)) 33 if (_.isEmpty(pathsToDelete)) return betLog({msg: 'no paths to delete', dirToDel}) 34 const {deleted} = await deleteObjects({bucket_name, keysA: pathsToDelete as string[]}) 38export const uploadfile = async () => { 39 const {bucket_name} = minioKubeCtx.getStore()! 40 const localPath = process.argv[4] 42 throwIf(() => !fs.existsSync(localPath), {localPath}) 44 const key = 'uploads/' + path.basename(localPath) 45 const body = fs.readFileSync(localPath) 51 throwIf(() => !body.equals(fetched), {key, fetchedLen: fetched.length, bodyLen: body.length}) 52 betLog({uploaded: key, verified: true, bytes: body.length}) 54uploadfile.cliAcceptsPositional = true