1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/ext/node/polyfills/internal_binding
Chen Su 507f24c474
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705)
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:

```ts
import { Buffer } from "node:buffer";

Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();

// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
//                    ^
//     at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
//     at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
//     at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
//     at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
//     at fromString (ext:deno_node/internal/buffer.mjs:214:22)
//     at _from (ext:deno_node/internal/buffer.mjs:119:12)
//     at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
//     at file:///Users/foodieats/temp/buffer1.ts:3:20
```

The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`

Also fixed #20563 .
2023-09-27 07:54:19 -06:00
..
_libuv_winerror.ts perf(ext/node): move winerror binding to rust (#17792) 2023-02-16 19:19:32 +05:30
_listen.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
_node.ts chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
_timingSafeEqual.ts refactor: rename built-in node modules from ext:deno_node/ to node: (#19680) 2023-07-02 20:19:30 +02:00
_utils.ts fix(ext/node): fix TypeError in Buffer.from with base64url encoding. (#20705) 2023-09-27 07:54:19 -06:00
ares.ts feat(ext/node): embed std/node into the snapshot (#17724) 2023-02-14 17:38:45 +01:00
async_wrap.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
buffer.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
cares_wrap.ts feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
connection_wrap.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
constants.ts feat(ext/node): embed std/node into the snapshot (#17724) 2023-02-14 17:38:45 +01:00
crypto.ts refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
handle_wrap.ts fix: lint on main branch (#19622) 2023-06-27 17:35:19 +09:00
mod.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
node_file.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
node_options.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
pipe_wrap.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
README.md feat(ext/node): embed std/node into the snapshot (#17724) 2023-02-14 17:38:45 +01:00
stream_wrap.ts perf(node/net): optimize socket reads for 'npm:ws' package (#20449) 2023-09-11 20:38:57 +02:00
string_decoder.ts refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041) 2023-03-08 12:44:54 +01:00
symbols.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
tcp_wrap.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00
types.ts perf(ext/node): optimize net streams (#19678) 2023-07-05 22:45:10 +05:30
udp_wrap.ts refactor: rename built-in node modules from ext:deno_node/ to node: (#19680) 2023-07-02 20:19:30 +02:00
util.ts feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
uv.ts chore(ext/node): disable prefer-primordials on a per-file basis (#19553) 2023-06-27 15:18:22 +09:00

Internal Bindings

The modules in this directory implement (simulate) C++ bindings implemented in the ./src/ directory of the Node.js repository.

These bindings are created in the Node.js source code by using NODE_MODULE_CONTEXT_AWARE_INTERNAL.

Please refer to https://github.com/nodejs/node/blob/master/src/README.md for further information.