Improve readability

This commit is contained in:
syuilo 2018-07-27 03:21:50 +09:00
parent 0b747b901c
commit 7e8c5c0c3c
1 changed files with 6 additions and 1 deletions

View File

@ -25,9 +25,14 @@ async function save(readable: stream.Readable, name: string, type: string, hash:
const minio = new Minio.Client(config.drive.config); const minio = new Minio.Client(config.drive.config);
const id = uuid.v4(); const id = uuid.v4();
const obj = `${config.drive.prefix}/${id}`; const obj = `${config.drive.prefix}/${id}`;
const baseUrl = config.drive.baseUrl const baseUrl = config.drive.baseUrl
|| `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`; || `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`;
await minio.putObject(config.drive.bucket, obj, readable, size, { 'Content-Type': type, 'Cache-Control': 'max-age=31536000, immutable' });
await minio.putObject(config.drive.bucket, obj, readable, size, {
'Content-Type': type,
'Cache-Control': 'max-age=31536000, immutable'
});
Object.assign(metadata, { Object.assign(metadata, {
withoutChunks: true, withoutChunks: true,