@inrupt/solid-client
    Preparing search index...

    Function overwriteFile

    • Saves a file at a given URL. If a file already exists at the URL, the function overwrites the existing file.

      For example:

      const savedFile = await overwriteFile(
      "https://pod.example.com/some/container/myFile.txt",
      new File(["This is a plain piece of text"], "myFile", { type: "text/plain" }),
      { fetch: fetch }
      );

      For additional example, see Read/Write Files.

      Recommended: In the options parameter, you can specify the media type of the file in the contentType. If unspecified, the function uses the default type of application/octet-stream, indicating a binary data file.

      When saving a file with [[overwriteFile]], the Solid server creates any intermediary Containers as needed; i.e., the Containers do not need to be created in advance. For example, when saving a file to the target URL of https://example.pod/container/resource, if https://example.pod/container/ does not exist, the container is created as part of the save.

      Type Parameters

      • FileExt extends File | Blob | File

      Parameters

      • fileUrl: string | Url

        The URL where the file is saved.

      • file: FileExt

        The file to be written.

      • Optionaloptions: Partial<WriteFileOptions>

        Additional parameters for file creation (e.g., media type).

      Returns Promise<FileExt & WithResourceInfo>