Open DevShivmohan opened 6 months ago
In GraphQL api we need to send the file bytes into string as a response
@GraphQLQuery(name = "downloadReport") public FileDownloadResponseDTO downloadReport() throws IOException { final InputStream inputStream=new FileInputStream("/home/shiv/Downloads/Shiv_resume_28_Nov_2023.pdf"); final var reportIntoByteArrayToString= Base64.getEncoder().encodeToString(inputStream.readAllBytes()); inputStream.close(); System.out.println(reportIntoByteArrayToString); return FileDownloadResponseDTO.builder().contentType("application/pdf").content(reportIntoByteArrayToString).build(); }
In GraphQL api we need to send the file bytes into string as a response