Socket
Book a DemoInstallSign in
Socket

@shelf/aws-lambda-libreoffice

Package Overview
Dependencies
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shelf/aws-lambda-libreoffice

92 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
8.5K
21.37%
Maintainers
7
Weekly downloads
 
Created
Source

aws-lambda-libreoffice

85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli

Inspired by chrome-aws-lambda

:information_source: Compiled LibreOffice version: 6.4.0.1

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 {unpack, defaultArgs} = require('@shelf/aws-lambda-libreoffice');

await unpack(); // default path /tmp/instdir/program/soffice.bin

execSync(
  `/tmp/instdir/program/soffice.bin ${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

Keywords

aws lambda

FAQs

Package last updated on 10 Jan 2020

Did you know?

Socket

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.

Install

Related posts