pandoc precompiled binary for AWS Lambda with a Node.js wrapper

aws, lambda, pandoc, serverless, docx, markdown
npm install pandoc-aws-lambda-binary@1.1.1


Pandoc for AWS Lambda

This is a binary package and a Node.js wrapper for a precompiled version of Pandoc for the Amazon Linux machine image used by AWS Lambda. It can help you get started quickly with Pandoc inside Lambda functions.

Check out the Running Pandoc on Lambda Guide for information on how this binary was produced, and how to compile a different version yourself with modified options.

Usage without Node.js

To use without Node.js, grab the binary from vendor/pandoc.gz and upload to Lambda yourself. This is gzipped to save space, so unpack it first before executing.

Usage from Node.js

Include the pandoc-aws-lambda-binary package using NPM, and make sure to package it with your Lambda function code:

npm install pandoc-aws-lambda-binary -S

Require and call the NPM package function from your Lambda code:

var pandoc = require('pandoc-aws-lambda-binary');

var resultPromise = pandoc(inputFilePath, outputFilePath, additionalOptions);


  • inputFilePath: string -- file you want to convert
  • outputFilePath: string -- path to save the results
  • additionalOptions: array -- any other options you want to pass to the pandoc executable

The options will be concatenated into a command such as pandoc inputFilePath -o outputFilePath additionalOptions.

Return value

The pandoc function is asynchronous and returns a JavaScript Promise, that will be resolved or rejected depending on the results of the command execution.

Full Example

Check out the Pandoc S3 Converter Example Project to see how to wire everything up into a Lambda function.

Local usage

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

Version information

Compiled for ami-4fffc83, for Linux kernel version 4.9.38-16.35.amzn1.x86_64.

pandoc 2.2.1
Compiled with pandoc-types, texmath, skylighting 0.7.1
Default user data directory: /home/ec2-user/.pandoc
Copyright (C) 2006-2018 John MacFarlane
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.


To keep things consistent, this library is released under GPL. If this is a problem for you, check out the Running Pandoc on Lambda Guide for information on how to produce the binary yourself.

Pandoc is free software, released under the GPL. © 2006-2018 John MacFarlane.