@lkaopremier/html-to-docx 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/cli.js +2 -2
- package/package.json +3 -3
- package/src/helper.js +3 -3
package/bin/cli.js
CHANGED
@@ -455,7 +455,7 @@ htmlToDocx(doc).then(buffer => {
|
|
455
455
|
})*/
|
456
456
|
|
457
457
|
htmlToDocx(doc2).then(buffer => {
|
458
|
-
unlinkSync('output_2.docx')
|
459
|
-
writeFileSync('output_2.docx', buffer)
|
458
|
+
unlinkSync('./demo/output_2.docx')
|
459
|
+
writeFileSync('./demo/output_2.docx', buffer)
|
460
460
|
console.log('File saved as output_2.docx')
|
461
461
|
})
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lkaopremier/html-to-docx",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2",
|
4
4
|
"main": "src/index.js",
|
5
5
|
"type": "module",
|
6
6
|
"keywords": [],
|
@@ -11,9 +11,9 @@
|
|
11
11
|
"docx": "^9.0.3",
|
12
12
|
"html-entities": "^2.5.2",
|
13
13
|
"html-minifier": "^4.0.0",
|
14
|
+
"image-size": "^1.1.1",
|
14
15
|
"lodash": "^4.17.21",
|
15
|
-
"node-html-parser": "^6.1.13"
|
16
|
-
"sharp": "^0.33.5"
|
16
|
+
"node-html-parser": "^6.1.13"
|
17
17
|
},
|
18
18
|
"bin": {
|
19
19
|
"html-to-docx": "bin/cli.js"
|
package/src/helper.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { parse as htmlParser } from 'node-html-parser'
|
2
2
|
import { minify } from 'html-minifier'
|
3
|
-
import
|
3
|
+
import sizeOf from 'image-size'
|
4
4
|
|
5
5
|
export function normalizeHtml(content) {
|
6
6
|
const elm = htmlParser(content)
|
@@ -301,8 +301,8 @@ export async function imageBase64ToBuffer(base64Content) {
|
|
301
301
|
return undefined
|
302
302
|
}
|
303
303
|
|
304
|
-
const
|
305
|
-
const { width, height } =
|
304
|
+
const dimensions = sizeOf(buffer)
|
305
|
+
const { width, height } = dimensions
|
306
306
|
|
307
307
|
if (!width || !height) {
|
308
308
|
return undefined
|