Edits history of script submission #5970 for ' Permanently delete file from S3 (windmill)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    /**
     * Permanently delete file from S3
     *
     */
    export async function main(workspace: string, file_key: string | undefined) {
      const url = new URL(
        `${BASE_URL}/api/w/${workspace}/job_helpers/delete_s3_file`
      );
      for (const [k, v] of [["file_key", file_key]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + WM_TOKEN,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 370 days ago

  • nativets
    /**
     * Permanently delete file from S3
     *
     */
    export async function main(workspace: string, file_key: string | undefined) {
      const url = new URL(
        `${BASE_URL}/api/w/${workspace}/job_helpers/delete_s3_file`
      );
      for (const [k, v] of [["file_key", file_key]]) {
        if (v !== undefined && v !== "") {
          url.searchParams.append(k, v);
        }
      }
      const response = await fetch(url, {
        method: "DELETE",
        headers: {
          Authorization: "Bearer " + WM_TOKEN,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 797 days ago