@jsreport/office
Advanced tools
Comparing version 3.0.0 to 4.0.0
@@ -0,6 +1,4 @@ | ||
const fs = require('fs/promises') | ||
const axios = require('axios') | ||
const FormData = require('form-data') | ||
const toArray = require('stream-to-array') | ||
const { promisify } = require('util') | ||
const toArrayAsync = promisify(toArray) | ||
@@ -22,3 +20,3 @@ const officeDocuments = { | ||
officeDocumentType, | ||
stream, | ||
filePath, | ||
buffer, | ||
@@ -30,3 +28,3 @@ logger | ||
} else { | ||
res.content = Buffer.concat(await toArrayAsync(stream)) | ||
res.content = await fs.readFile(filePath) | ||
} | ||
@@ -57,2 +55,4 @@ | ||
logger.debug('preparing office preview', req) | ||
const form = new FormData() | ||
@@ -71,3 +71,3 @@ | ||
// https://github.com/axios/axios/issues/1362 (when following redirects) in | ||
// which the default limit is not taking into account, so we set it explicetly | ||
// which the default limit is not taking into account, so we set it explicitly | ||
maxContentLength: Infinity | ||
@@ -83,2 +83,3 @@ }) | ||
message += ` (full error: ${e.message})` | ||
logger.error(message, req) | ||
@@ -85,0 +86,0 @@ |
@@ -1,11 +0,10 @@ | ||
const fs = require('fs') | ||
const saveXmlsToOfficeFile = require('./saveXmlsToOfficeFile') | ||
module.exports = async ({ reporter, files, officeDocumenType }, req, res) => { | ||
module.exports = async ({ reporter, files, officeDocumentType }, req, res) => { | ||
const { | ||
pathToFile: officeFileName | ||
} = await reporter.writeTempFile((uuid) => `${uuid}.${officeDocumenType}`, '') | ||
pathToFile: officeOutputFilePath | ||
} = await reporter.writeTempFile((uuid) => `${uuid}.${officeDocumentType}`, '') | ||
await saveXmlsToOfficeFile({ | ||
outputPath: officeFileName, | ||
outputPath: officeOutputFilePath, | ||
files | ||
@@ -15,3 +14,4 @@ }) | ||
reporter.logger.debug('Successfully zipped now.', req) | ||
res.stream = fs.createReadStream(officeFileName) | ||
return officeOutputFilePath | ||
} |
{ | ||
"name": "@jsreport/office", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Some helpers for office based jsreport recipes", | ||
"homepage": "https://github.com/jsreport/jsreport/tree/master/packages/office#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jsreport/jsreport.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Jan Blaha", | ||
"main": "index.js", | ||
@@ -9,15 +16,12 @@ "directories": { | ||
}, | ||
"files": [ | ||
"lib", | ||
"index.js" | ||
], | ||
"scripts": { | ||
"test": "mocha test --timeout 8000 && standard" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jsreport/jsreport.git" | ||
}, | ||
"author": "Jan Blaha", | ||
"license": "MIT", | ||
"homepage": "https://github.com/jsreport/jsreport/tree/master/packages/office#readme", | ||
"dependencies": { | ||
"archiver": "5.3.0", | ||
"axios": "0.23.0", | ||
"axios": "1.6.2", | ||
"form-data": "2.5.0", | ||
@@ -27,3 +31,2 @@ "get-stream": "5.1.0", | ||
"pify": "4.0.1", | ||
"stream-to-array": "2.3.0", | ||
"yauzl": "2.10.0", | ||
@@ -35,8 +38,4 @@ "zip": "1.2.0" | ||
"should": "13.2.3", | ||
"standard": "16.0.3" | ||
"standard": "16.0.4" | ||
}, | ||
"files": [ | ||
"lib", | ||
"index.js" | ||
], | ||
"standard": { | ||
@@ -43,0 +42,0 @@ "env": { |
@@ -8,4 +8,10 @@ # @jsreport/office | ||
### 4.0.0 | ||
- fix asset office preview throwing error on studio | ||
- refactor @jsreport/office to require file path instead of stream | ||
- fix memory being held when timeouts are large | ||
### 3.0.0-beta.1 | ||
Adaptations for the v3 APIs |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
9100
8
17
0
201
+ Addedaxios@1.6.2(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removedstream-to-array@2.3.0
- Removedany-promise@1.3.0(transitive)
- Removedaxios@0.23.0(transitive)
- Removedstream-to-array@2.3.0(transitive)
Updatedaxios@1.6.2