For automatically packaged lambdas, is there a way...
# typescript
b
For automatically packaged lambdas, is there a way to work around that you can't capture native code functions? I have a powerful need to work with `Buffer`s. 😕 (Namely, I need
zlib
.)
w
You should in generally not need to "capture" them, you should be able to just load them from "inside". As a quite general point, it is worth trying to keep the amount of data that is captured by your automatic lambdas to a minimum. The specifics here likely depend on how your code is structured - but I'd be surprised if you cannot accomplish what you want here by loading the desired librarires inside and capturing only "data" from the ambient environment.
b
I'm confused, at least from idiomatic TypeScript. Are you saying to
require()
them inside the lambda environment?
I must be misunderstanding the mechanism behind hoisting libraries (tbh I'm not even sure whether you call doing so capturing, hoisting, etc!). It's pretty magical. 😉
w
b
Aha. I went looking, but somehow missed that one. Thanks.