https://github.com/shelfio/aws-lambda-brotli-unpacker
Unpacks large Lambda binaries to /tmp
https://github.com/shelfio/aws-lambda-brotli-unpacker
aws-lambda brotli node-module nodejs npm-package serverless
Last synced: 5 months ago
JSON representation
Unpacks large Lambda binaries to /tmp
- Host: GitHub
- URL: https://github.com/shelfio/aws-lambda-brotli-unpacker
- Owner: shelfio
- License: mit
- Created: 2018-11-03T19:43:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-28T00:42:29.000Z (5 months ago)
- Last Synced: 2025-05-28T01:35:03.937Z (5 months ago)
- Topics: aws-lambda, brotli, node-module, nodejs, npm-package, serverless
- Language: TypeScript
- Size: 672 KB
- Stars: 9
- Watchers: 12
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# aws-lambda-brotli-unpacker [](https://circleci.com/gh/shelfio/aws-lambda-brotli-unpacker/tree/master) 
> Unpacks large Lambda binaries to /tmp, such as Tesseract, LibreOffice, Google Chrome, etc
Inspired by [chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda)
Used in projects: [aws-lambda-tesseract](https://github.com/shelfio/aws-lambda-tesseract)
## Install
```
$ yarn add @shelf/aws-lambda-brotli-unpacker
```
Version 1.x works with Node 10.x & 12.x only. For Node 8.10 use v0.0.2
## Test
Needs Docker installed.
```
$ npm test
```
## Usage
> Q: Why do I need this package?
A: It helps if you want to deploy pre-compiled software to use in Lambda. See list of projects where it is used above.
> Q: Why bother?
A: Lambda environment has limited software installed. This package helps ship large binaries compiled for Lambda
which unpack to `/tmp` folder when Lambda starts.
> Q: Why `/tmp`?
A: Lambda has [500 MB of storage](https://docs.aws.amazon.com/lambda/latest/dg/running-lambda-code.html) in `/tmp`
> Q: Why brotli?
A: This compression algorithm is known for great speed/size ration. Perfect for scarce Lambda resources.
## Example
```js
const {unpack} = require('@shelf/aws-lambda-brotli-unpacker');
const {execSync} = require('child_process');
const inputPath = path.join(__dirname, '..', 'bin', 'tt.tar.br'); // for example, tesseract
const outputPath = '/tmp/tesseract/tesseract';
module.exports.handler = async event => {
await unpack({inputPath, outputPath});
execSync(`${outputPath} -l eng image.png`);
};
```
## Publish
```sh
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
```
## License
MIT © [Shelf](https://shelf.io)