
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
generate-docx
Advanced tools
Generates .docx from template and data
Returns a Buffer or saves the generated file if given path and filename.
const generateDocx = require('generate-docx')
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
},
save: {
filePath: 'test/data/savedfile.docx'
}
}
generateDocx(options)
.then(console.log)
.catch(console.error)
const generateDocx = require('generate-docx')
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
},
save: {
filePath: 'test/data/savedfile.docx'
}
}
generateDocx(options, (error, message) => {
if (error) {
console.error(error)
} else {
console.log(message)
}
})
const { writeFileSync } = require('fs')
const generateDocx = require('generate-docx')
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
}
}
generateDocx(options)
.then(buf => {
writeFileSync('test/data/frombuffer.docx', buf)
console.log('File written')
}).catch(console.error)
const { writeFileSync } = require('fs')
const generateDocx = require('generate-docx')
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is my temple'
}
}
}
generateDocx(options, (error, buf) => {
if (error) {
console.error(error)
} else {
writeFileSync('test/data/frombuffer.docx', buf)
console.log('File written')
}
})
If you need to pass an option object to configure docxtemplater you can do using templateOptions
.
For example you can configure docxtemplater to parse \n
as a linebreak in the document
const options = {
template: {
filePath: 'test/data/testdoc.docx',
data: {
title: 'This is the title',
description: 'Description is good',
body: 'My body is \n my temple'
}
},
templateOptions: {
linebreaks: true
},
save: {
filePath: 'test/data/savedfile.docx'
}
}
FAQs
Generates .docx from template and data
The npm package generate-docx receives a total of 25 weekly downloads. As such, generate-docx popularity was classified as not popular.
We found that generate-docx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.