
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
@shelf/aws-lambda-libreoffice
Advanced tools
Utility to work with Docker version of LibreOffice in Lambda
$ yarn add @shelf/aws-lambda-libreoffice
First, you need to create a Docker image for your Lambda function. See the example at libreoffice-lambda-base-image repo.
Example:
FROM public.ecr.aws/shelf/lambda-libreoffice-base:7.3-node16-x86_64
COPY ./ ${LAMBDA_TASK_ROOT}/
RUN yarn install
CMD [ "handler.handler" ]
ephemeral-storage parameterGiven you have packaged your Lambda function as a Docker image, you can now use this package:
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
// it is optional to invoke this function, you can skip it if you're sure about file format
if (!canBeConvertedToPDF('document.docx')) {
return false;
}
return convertTo('document.docx', 'pdf'); // returns /tmp/document.pdf
};
This version requires Node 12.x or higher.
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.
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`
);
Beside unit tests that could be run via yarn test, there are integration tests.
Smoke test that it works: ./test/test.sh.
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
MIT © Shelf
FAQs
Utility to work with Docker version of LibreOffice in Lambda
The npm package @shelf/aws-lambda-libreoffice receives a total of 6,333 weekly downloads. As such, @shelf/aws-lambda-libreoffice popularity was classified as popular.
We found that @shelf/aws-lambda-libreoffice demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 58 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.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.