Skip to content

Commit 2010da5

Browse files
authored
doc: use ffi.suffix in permission example
The `--allow-ffi` example in cli.md hard-coded the Linux-only `.so` extension. node:ffi already exposes `suffix` for exactly this case, and doc/api/ffi.md's own examples use it. Do the same here. Assisted-by: Claude Sonnet 5 Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com> PR-URL: #64914 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 7cb4e7f commit 2010da5

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

doc/api/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ starting Node.js. The [`node:ffi`][] module also requires the
208208
Example:
209209

210210
```js
211-
const { DynamicLibrary } = require('node:ffi');
212-
const lib = new DynamicLibrary('mylib.so');
211+
const { DynamicLibrary, suffix } = require('node:ffi');
212+
const lib = new DynamicLibrary(`./mylib.${suffix}`);
213213
```
214214

215215
```console

doc/node.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ starting Node.js. The \fBnode:ffi\fR module also requires the
126126
\fB--experimental-ffi\fR flag and is only available in builds with FFI support.
127127
Example:
128128
.Bd -literal
129-
const { DynamicLibrary } = require('node:ffi');
130-
const lib = new DynamicLibrary('mylib.so');
129+
const { DynamicLibrary, suffix } = require('node:ffi');
130+
const lib = new DynamicLibrary(`./mylib.${suffix}`);
131131
.Ed
132132
.Bd -literal
133133
$ node --permission --experimental-ffi index.js

0 commit comments

Comments
 (0)