2. 将准备的程序块注入 node 二进制文件


🌐 2. Injecting the preparation blob into the node binary

为了完成单一可执行应用的创建,生成的 blob 需要注入到 node 二进制文件的副本中,如下所述。

🌐 To complete the creation of a single executable application, the generated blob needs to be injected into a copy of the node binary, as documented below.

在使用 --build-sea 时,这一步会在内部与 blob 生成一起完成。

🌐 When using --build-sea, this step is done internally along with the blob generation.

  • 如果 node 二进制文件是 体育 文件,则该 blob 应作为名为 NODE_SEA_BLOB 的资源注入。
  • 如果 node 二进制文件是一个 Mach-O 文件,则应该将 blob 注入到 NODE_SEA 段中名为 NODE_SEA_BLOB 的节中。
  • 如果 node 二进制文件是 精灵 文件,则该 blob 应作为名为 NODE_SEA_BLOB 的注释注入。

然后,SEA 构建过程会在二进制文件中搜索 NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2:0 保险丝 字符串,并将最后一个字符翻转为 1,以表示已注入资源。

🌐 Then, the SEA building process searches the binary for the NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2:0 fuse string and flip the last character to 1 to indicate that a resource has been injected.