|
|
|
@ -36,6 +36,19 @@ public class MinioUtil {
|
|
|
|
|
return objectWriteResponse.object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 上传文件
|
|
|
|
|
* @param stream 文件流
|
|
|
|
|
* @param contentType 文件类型
|
|
|
|
|
* @return 文件id
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public static String uploadFile(InputStream stream,String contentType) throws Exception {
|
|
|
|
|
ObjectWriteResponse objectWriteResponse = minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(UUID.randomUUID().toString())
|
|
|
|
|
.stream(stream, stream.available(), -1).contentType(contentType).build());
|
|
|
|
|
return objectWriteResponse.object();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载一个文件
|
|
|
|
|
*/
|
|
|
|
|