Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (15 sloc) 495 Bytes
(ns performance.core
(:require
[cljs-lambda.context :as ctx]
[cljs-lambda.util :refer [async-lambda-fn]]
[cljs.nodejs :as node]))
(def fs (node/require "fs"))
(def ^{:export true} handler
(async-lambda-fn
(fn [ev ctx]
(try
(when (= "hallo" (.readFileSync fs "/tmp/perf.txt" "UTF-8"))
(ctx/succeed! ctx "reused"))
(catch :default e
(.writeFileSync fs "/tmp/perf.txt" "hallo")
(ctx/succeed! ctx "new"))))))