sea.getAsset(key[, encoding])


此方法可用于检索配置为在构建时打包到单个可执行应用中的资源。当找不到匹配的资源时会抛出错误。

¥This method can be used to retrieve the assets configured to be bundled into the single-executable application at build time. An error is thrown when no matching asset can be found.

  • key <string> 单一可执行应用配置中的 assets 字段指定的字典中资源的键。

    ¥key <string> the key for the asset in the dictionary specified by the assets field in the single-executable application configuration.

  • encoding <string> 如果指定,资源将被解码为字符串。接受 TextDecoder 支持的任何编码。如果未指定,则将返回包含资源副本的 ArrayBuffer

    ¥encoding <string> If specified, the asset will be decoded as a string. Any encoding supported by the TextDecoder is accepted. If unspecified, an ArrayBuffer containing a copy of the asset would be returned instead.

  • 返回:<string> | <ArrayBuffer>

    ¥Returns: <string> | <ArrayBuffer>