|
1 | 1 | # Pandoc for AWS Lambda
|
2 | 2 |
|
3 |
| -This is a binary package and a Node.js wrapper for a precompiled version of [Pandoc](http://pandoc.org/) for the Amazon Linux machine image used by AWS Lambda. It can help you get started quickly with Pandoc inside Lambda functions. |
| 3 | +This is a precompiled version of [Pandoc](http://pandoc.org/) for the Amazon Linux machine image used by AWS Lambda, deployable as an AWS lambda layer. It can help you get started quickly with Pandoc inside Lambda functions. |
4 | 4 |
|
5 | 5 | Check out the [Running Pandoc on Lambda Guide](https://claudiajs.com/tutorials/pandoc-lambda.html) for information on how this binary was produced, and how to compile a different version yourself with modified options.
|
6 | 6 |
|
7 |
| -## Usage without Node.js |
8 |
| - |
9 |
| -To use without Node.js, grab the binary from [vendor/pandoc.gz](vendor/pandoc.gz) and upload to Lambda yourself. This is gzipped to save space, so unpack it first before executing. |
10 |
| - |
11 |
| -## Usage from Node.js |
12 |
| - |
13 |
| -Include the `pandoc-aws-lambda-binary` package using NPM, and make sure to package it with your Lambda function code: |
14 |
| - |
15 |
| -```bash |
16 |
| -npm install pandoc-aws-lambda-binary -S |
17 |
| -``` |
18 |
| - |
19 |
| -Require and call the NPM package function from your Lambda code: |
20 |
| - |
21 |
| - |
22 |
| -```js |
23 |
| -var pandoc = require('pandoc-aws-lambda-binary'); |
24 |
| - |
25 |
| -var resultPromise = pandoc(inputFilePath, outputFilePath, additionalOptions); |
26 |
| -``` |
27 |
| - |
28 |
| -### Options |
29 |
| - |
30 |
| -* `inputFilePath`: `string` -- file you want to convert |
31 |
| -* `outputFilePath`: `string` -- path to save the results |
32 |
| -* `additionalOptions`: `array` -- any other options you want to pass to the pandoc executable |
33 |
| - |
34 |
| -The options will be concatenated into a command such as `pandoc inputFilePath -o outputFilePath additionalOptions`. |
35 |
| - |
36 |
| -### Return value |
37 |
| - |
38 |
| -The `pandoc` function is asynchronous and returns a JavaScript Promise, that will be resolved or rejected depending on the results of the command execution. |
39 |
| - |
40 |
| -### Full Example |
41 |
| - |
42 |
| -Check out the [Pandoc S3 Converter Example Project](https://github.com/claudiajs/example-projects/tree/master/pandoc-s3-converter) to see how to wire everything up into a Lambda function. |
43 |
| - |
44 |
| -## Local usage |
45 |
| - |
46 |
| -To run this in local tests, define a `PANDOC_PATH` environment variable and set it to your local Pandoc executable. It will then use the provided executable instead of unpacking the Lambda binary |
47 |
| - |
48 | 7 | ## Version information
|
49 | 8 |
|
50 | 9 | Compiled for [`ami-4fffc83`](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Images:visibility=public-images;search=amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2;sort=name), for Linux kernel version 4.9.38-16.35.amzn1.x86_64.
|
|
0 commit comments