@attyou/firebase-libreoffice
TypeScript icon, indicating that this package has built-in type declarations

3.0.7 • Public • Published

aws-lambda-libreoffice

85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli forked from shelfio/aws-lambda-libreoffice this is the 2.2.0 version fo shelfio/aws-lambda-libreoffice , juste i have update @shelf/aws-lambda-brotli-unpacker to v1.0.0

Inspired by chrome-aws-lambda

ℹ️ Compiled LibreOffice version: 6.1.0.0.alpha0

Install

$ yarn add @shelf/aws-lambda-libreoffice

NOTE: Since version 2.0.0 npm package no longer ships the 85 MB LibreOffice but relies upon libreoffice-lambda-layer instead. Follow the instructions on how to add a lambda layer in that repo.

Usage

const {convertTo, canBeConvertedToPDF} = require('@shelf/aws-lambda-libreoffice');

module.exports.handler = async () => {
  // assuming there is a document.docx file inside /tmp dir
  // original file will be deleted afterwards

  if (!canBeConvertedToPDF('document.docx')) {
    return false;
  }

  return convertTo('document.docx', 'pdf'); // returns /tmp/document.pdf
};

Or if you want more control:

const {getExecutablePath, defaultArgs} = require('@shelf/aws-lambda-libreoffice');

const loBinary = await getExecutablePath(); // /tmp/instdir/program/soffice

execSync(`${loBinary} ${defaultArgs.join(' ')} --convert-to pdf file.docx --outdir /tmp`);

See Also

Test

Smoke test that it works: ./test.sh. Make sure to clone libreoffice-lambda-layer repo alongside

License

MIT © Shelf

Package Sidebar

Install

npm i @attyou/firebase-libreoffice

Weekly Downloads

1

Version

3.0.7

License

MIT

Unpacked Size

85.4 MB

Total Files

27

Last publish

Collaborators

  • attyou