Skip to content

Rename feature for filesystem #509

@Dual-Ice

Description

@Dual-Ice

Hello!
Could you provide rename from https://emscripten.org/docs/api_reference/Filesystem-API.html#FS.rename
May be It will be easier for you than do it

public async renameFile(oldPath: string, newPath: string) {
        try {
            const fileData = await this.webr.FS.readFile(oldPath);
            await this.webr.FS.writeFile((newPath, fileData); 
            await this.webr.FS.unlink(oldPath);
        } catch (e) {
            if (e instanceof WebrError) {
                throw new Error(`Unable to rename file: "${oldPath}".`);
            }
            Logger.$error(e);
        }
    }

for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions