You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/_includes/content/functions/runtime.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,30 @@ The following dependencies are installed in the function environment by default.
28
28
-[`uuidv5 v1.0.0`](https://www.npmjs.com/package/uuidv5) exposed as `uuidv5`
29
29
-[`xml v1.0.1`](https://www.npmjs.com/package/xml) exposed as `xml`
30
30
-[`xml2js v0.4.23`](https://www.npmjs.com/package/xml2js) exposed as `xml2js`
31
-
-[`zlib v1.0.5`](https://www.npmjs.com/package/zlib) exposed as `zlib`
31
+
-[`zlib v1.0.5`](https://www.npmjs.com/package/zlib) exposed as `zlib.zlib`
32
+
33
+
`zlib`'s asynchronous methods `inflate` and `deflate` must be used with `async` or `await`. For example:
34
+
35
+
```js
36
+
zlib =zlib.zlib; // Required to access zlib objects and associated functions
37
+
asyncfunctiononRequest(request, settings) {
38
+
constbody=request.json();
39
+
40
+
constinput='something';
41
+
42
+
// Calling inflateSync method
43
+
var deflated =zlib.deflateSync(input);
44
+
45
+
console.log(deflated.toString('base64'));
46
+
47
+
// Calling inflateSync method
48
+
var inflated =zlib.inflateSync(newBuffer.from(deflated)).toString();
49
+
50
+
console.log(inflated);
51
+
52
+
console.log('Done');
53
+
}
54
+
```
32
55
33
56
Only the [`crypto`Node.jsmodule](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html ) is included (exposed as `crypto`). [Other built-in Node.js modules](https://nodejs.org/api/modules.html) are not available.
0 commit comments