aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-02 01:45:42 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-02 01:45:42 -0700
commit97fa2702d1214c6d29f98d277796f316dc04c3df (patch)
treeb9b8b6eb9e60aebc887a2cf2f98c52c6e609a87b
parent4af4d3eeca01a520f805951b4ee4011a4d20caf1 (diff)
downloadbun-97fa2702d1214c6d29f98d277796f316dc04c3df.tar.gz
bun-97fa2702d1214c6d29f98d277796f316dc04c3df.tar.zst
bun-97fa2702d1214c6d29f98d277796f316dc04c3df.zip
Update README.md
-rw-r--r--README.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/README.md b/README.md
index 715af8234..fb613e66e 100644
--- a/README.md
+++ b/README.md
@@ -3832,7 +3832,7 @@ const [major, minor, patch] = [
Bun v0.2.3 added `JSCallback` which lets you create JavaScript callback functions that you can pass to C/FFI functions. The C/FFI function can call into the JavaScript/TypeScript code. This is useful for asynchronous code or otherwise when you want to call into JavaScript code from C.
```ts
-import { dlopen, JSCallback, ptr } from "bun:ffi";
+import { dlopen, JSCallback, ptr, CString } from "bun:ffi";
const {
symbols: { search },
@@ -3845,7 +3845,7 @@ const {
});
const searchIterator = new JSCallback(
- (ptr, length) => Buffer.from(ptr, length, "utf8").toString().test(/wut/i),
+ (ptr, length) => new CString(ptr, length).test(/wut/i),
{
returns: "bool",
args: ["ptr", "usize"],