mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
18 lines
563 B
JavaScript
18 lines
563 B
JavaScript
import rxjs from "../../lib/rx.js";
|
|
import ajax from "../../lib/ajax.js";
|
|
import { getDownloadUrl, getCurrentPath } from "./common.js";
|
|
|
|
export const options = () => ajax({
|
|
url: `api/files/cat?path=${encodeURIComponent(getCurrentPath())}`,
|
|
method: "OPTIONS",
|
|
}).pipe(rxjs.map((res) => res.responseHeaders.allow.replace(/\r/, "").split(", ")));
|
|
|
|
export const cat = () => ajax(getDownloadUrl()).pipe(
|
|
rxjs.map(({ response }) => response),
|
|
);
|
|
|
|
export const save = (content) => ajax({
|
|
url: getDownloadUrl(),
|
|
method: "POST",
|
|
body: content,
|
|
});
|