MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / create

Function create

frontend/src/api/share.ts:18–41  ·  view source on GitHub ↗
(
  url: string,
  password = "",
  expires = "",
  unit = "hours"
)

Source from the content-addressed store, hash-verified

16}
17
18export async function create(
19 url: string,
20 password = "",
21 expires = "",
22 unit = "hours"
23) {
24 url = removePrefix(url);
25 url = `/api/share${url}`;
26 if (expires !== "") {
27 url += `?expires=${expires}&unit=${unit}`;
28 }
29 let body = "{}";
30 if (password != "" || expires !== "" || unit !== "hours") {
31 body = JSON.stringify({
32 password: password,
33 expires: expires.toString(), // backend expects string not number
34 unit: unit,
35 });
36 }
37 return fetchJSON(url, {
38 method: "POST",
39 body: body,
40 });
41}
42
43export function getShareURL(share: Share) {
44 return createURL("share/" + share.hash, {});

Callers

nothing calls this directly

Calls 2

removePrefixFunction · 0.90
fetchJSONFunction · 0.90

Tested by

no test coverage detected