/** /s3/minio/b/f => { bucketName: 'b', fileName: 'f' } */ export default function split ( mountPath , filepath , subdir = '' ) { const s3PrefixIdx = mountPath . length + 1 ; const leftover = ( subdir ? subdir + '/' : '' ) + filepath . slice ( s3PrefixIdx ) ; const firstSlashIdx = leftover . indexOf ( '/' ) ; const bucketName = leftover . slice ( 0 , firstSlashIdx < 0 ? leftover . length : firstSlashIdx ) ; const fileName = firstSlashIdx >= 0 ? leftover . slice ( firstSlashIdx + 1 ) : undefined ; return { bucketName , fileName } ; }