Skip to content

Commit

Permalink
Add logging for buffer length in createDocumentBuffer functions
Browse files Browse the repository at this point in the history
  • Loading branch information
HlexNC committed Mar 29, 2024
1 parent f91a035 commit 9039e4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions officegen-api/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ app.post('/api/create-document', async (req, res) => {
app.post('/api/create-document/buffer', async (req, res) => {
try {
const buffer = await documentLibrary.createDocumentBuffer(req.body.elements, req.body.styles);
console.log(buffer.length + ' bytes written to buffer.');
res.setHeader('Content-Disposition', 'attachment; filename=document.docx');
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
res.send(buffer);
Expand Down
1 change: 1 addition & 0 deletions officegen-api/src/documentLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exports.createDocumentWithStructure = async (elements, styles) => {
exports.createDocumentBuffer = async (elements, styles) => {
try {
const buffer = await officegenHelper.createDocxBuffer(elements, styles);
console.log(buffer.length + ' bytes written to buffer.');
return buffer;
} catch (error) {
throw error;
Expand Down

0 comments on commit 9039e4b

Please sign in to comment.