import * as wmill from "https://deno.land/x/windmill@v1.47.3/mod.ts";
export async function main(
webdav_res: wmill.Resource<"webdav">,
filePath: string,
data: string,
) {
const resp = await fetch(
`${webdav_res.baseUrl}${filePath}`,
{
headers: {
"Authorization": "Basic " +
btoa(webdav_res.user + ":" + webdav_res.password),
},
method: "PUT",
body: Uint8Array.from(atob(data), c => c.charCodeAt(0)),
},
);
return {
ok: resp.ok,
status: resp.status,
text: await resp.text(),
};
}
Submitted by jaller94 766 days ago
import * as wmill from "https://deno.land/x/windmill@v1.35.0/mod.ts";
export async function main(
webdav_res: wmill.Resource<"c_webdav">,
filePath: string,
data: string,
) {
const resp = await fetch(
`${webdav_res.baseUrl}${filePath}`,
{
headers: {
"Authorization": "Basic " +
btoa(webdav_res.user + ":" + webdav_res.password),
},
method: "PUT",
body: Uint8Array.from(atob(data), c => c.charCodeAt(0)),
},
);
return {
ok: resp.ok,
status: resp.status,
text: await resp.text(),
};
}
Submitted by jaller94 813 days ago
import * as wmill from "https://deno.land/x/windmill@v1.35.0/mod.ts";
export async function main(
webdav_res: wmill.Resource<"c_webdav">,
filePath: string,
data: string,
) {
const resp = await fetch(
// This might be specific to Nextcloud
`${webdav_res.baseUrl}/dav/files/${webdav_res.user}/${filePath}`,
{
headers: {
"Authorization": "Basic " +
btoa(webdav_res.user + ":" + webdav_res.password),
},
method: "PUT",
body: Uint8Array.from(atob(data), c => c.charCodeAt(0)),
},
);
return {
ok: resp.ok,
status: resp.status,
text: await resp.text(),
};
}
Submitted by jaller94 813 days ago