Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libreoffice-convert

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libreoffice-convert - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

2

package.json
{
"name": "libreoffice-convert",
"version": "1.3.4",
"version": "1.3.5",
"description": "A simple and fast node.js module for converting office documents to different formats",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,33 +0,38 @@

# libreoffice-convert #
# libreoffice-convert
A simple and fast node.js module for converting office documents to different formats.
## Dependency ##
## Dependency
Please install libreoffice in /Applications (Mac), with your favorite package manager (Linux), or with the msi (Windows).
## Usage example
## Usage example ##
```javascript
const libre = require('libreoffice-convert');
'use strict';
const path = require('path');
const fs = require('fs');
const fs = require('fs').promises;
const extend = '.pdf'
const enterPath = path.join(__dirname, '/resources/example.docx');
const outputPath = path.join(__dirname, `/resources/example${extend}`);
const libre = require('libreoffice-convert');
libre.convertAsync = require('util').promisify(libre.convert);
// Read file
const file = fs.readFileSync(enterPath);
// Convert it to pdf format with undefined filter (see Libreoffice doc about filter)
libre.convert(file, extend, undefined, (err, done) => {
if (err) {
console.log(`Error converting file: ${err}`);
}
async function main() {
const ext = '.pdf'
const inputPath = path.join(__dirname, '/resources/example.docx');
const outputPath = path.join(__dirname, `/resources/example${ext}`);
// Read file
const docxBuf = await fs.readFile(inputPath);
// Convert it to pdf format with undefined filter (see Libreoffice docs about filter)
let pdfBuf = await libre.convertAsync(docxBuf, ext, undefined);
// Here in done you have pdf file which you can save or transfer in another stream
fs.writeFileSync(outputPath, done);
await fs.writeFile(outputPath, pdfBuf);
}
main().catch(function (err) {
console.log(`Error converting file: ${err}`);
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc