Skip to content

Instantly share code, notes, and snippets.



Created Aug 28, 2015
What would you like to do?
Using iojs on AWS Lambda
import {join} from "path"
import browserify from "browserify"
import babelify from "babelify"
import archiver from "archiver"
let opts = {
standalone: "code",
// these are the API equivalent of --node
bare: true,
browserField: false,
builtins: false,
commondir: false,
detectGlobals: false,
igv: "__filename,__dirname"
let handlerPath = join(__dirname, process.argv[2])
let indexPath = join(__dirname, "index.js")
let iojsPath = join(__dirname, "vendor", "iojs")
let iojs = createReadStream(iojsPath)
let handler = browserify(handlerPath, opts)
let index = browserify(indexPath, opts)
let zip = archiver("zip")
.append(iojs, {name: "iojs", mode: 0o755})
.append(handler, {name: "handler.js"})
.append(index, {name: "index.js"})
$ babel-node bundle.js my-lambda.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment