Skip to content

Commit f6ff0fe

Browse files
committed
docs: describe what's inside this layer
1 parent ef9b755 commit f6ff0fe

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

readme.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
# LibreOffice for AWS Lambda as a layer
22

3-
> 95 MB LibreOffice to fit inside AWS Lambda Layer compressed with Brotli
3+
> 95 MB LibreOffice to fit inside AWS Lambda Layer compressed with Brotli or gzip
44
55
Based on the [serverless-libreoffice](https://github.com/vladgolubev/serverless-libreoffice) project.
66

77
## Getting Started
88

9-
You can add this layer to any Lambda function you want – no matter what runtime
10-
11-
Click on Layers and choose "Add a layer", and "Provide a layer version
12-
ARN" and enter the following ARN.
9+
Click on Layers and choose "Add a layer", and "Provide a layer version ARN" and enter the following ARN.
1310

1411
```
1512
arn:aws:lambda:us-east-1:764866452798:layer:libreoffice:9
1613
```
1714

18-
See the table below for other supported regions.
15+
See the table below for the list of supported regions and runtimes.
1916

2017
Works well with [aws-lambda-libreoffice npm package](https://github.com/shelfio/aws-lambda-libreoffice)
2118

22-
## What does this layer contain?
19+
## What's inside this layer?
20+
21+
`libreoffice-brotli` layer contains `lo.tar.br` file which is LibreOffice v6.4.0.1 (https://github.com/vladgolubev/serverless-libreoffice/releases/tag/v6.4.0.1). Node.js has native Brotli unpacking support since version 10 so it's easy to unpack this file natively. Alternatively, you can use [aws-lambda-libreoffice npm package](https://github.com/shelfio/aws-lambda-libreoffice) to simplify this task.
2322

24-
This layer contains `lo.tar.br` file which is LibreOfficee v6.4.0.1 (https://github.com/vladgolubev/serverless-libreoffice/releases/tag/v6.4.0.1).
23+
`libreoffice-gzip` layer contains `lo.tar.gz` file which is LibreOffice v6.4.0.1 (https://github.com/vladgolubev/serverless-libreoffice/releases/tag/v6.4.0.1).
2524

26-
## Where is LibreOffice inside of Lambda?
25+
## How do I use this layer to launch LibreOffice?
2726

28-
It is at `/opt/lo.tar.br`.
27+
If you don't use [aws-lambda-libreoffice npm package](https://github.com/shelfio/aws-lambda-libreoffice), then these steps are roughly what you need to do.
28+
29+
1. This layer just adds `/opt/lo.tar.br` or `/opt/lo.tar.gz` file to your Lambda runtime
30+
2. Unpack `/opt/lo.tar.br` or `/opt/lo.tar.gz` file during Lambda execution into `/tmp` folder which has 512 MB of free space. Make sure to do this OUTSIDE function handler code.
31+
This is an expensive task, so better to make it once on a warm start.
32+
3. LibreOffice binary will be located available at `/opt/instdir/program/soffice.bin`
33+
4. Check out `/test/index.js` for CLI arguments needed to run LibreOffice to convert a `.txt` file to `.pdf` for more details
2934

3035
## Version ARNs
3136

@@ -79,3 +84,4 @@ Works with the following [AWS Lambda runtimes](https://docs.aws.amazon.com/lambd
7984
## License
8085

8186
MIT © [Shelf](https://shelf.io)
87+

0 commit comments

Comments
 (0)