文件写入是否提供再后续写入的功能

现在是分片下载文件流后,创建数组来操作数据流,数据一大就会没有这么多内存,写入文件的接口没有看到偏移量操作,是否有可以偏移写入文件的接口

帮你查了下字节小游戏平台的 api,只提供了最通用的功能,没有看到与你需求描述相符的内容。
https://microapp.bytedance.com/docs/zh-CN/mini-game/develop/api/file/file-system-manager/file-system-manager-write-file

不是字节的 写错了 原生的

大佬 能帮忙看下 原生的支持追加 写入吗 js 调用的

目前不行writeDataToFile是已wb打开文件的

bool FileUtils::writeDataToFile(const Data& data, const std::string& fullPath)
{
    size_t size = 0;
    const char* mode = "wb";

    CCASSERT(!fullPath.empty() && data.getSize() != 0, "Invalid parameters.");

    auto fileutils = FileUtils::getInstance();
    do
    {
        // Read the file from hardware
        FILE *fp = fopen(fileutils->getSuitableFOpen(fullPath).c_str(), mode);
        CC_BREAK_IF(!fp);
        size = data.getSize();

        fwrite(data.getBytes(), size, 1, fp);

        fclose(fp);

        return true;
    } while (0);

    return false;
}

改个接口把mode暴露给js

1赞

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。