mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-13 11:58:04 +01:00
18 lines
481 B
JavaScript
18 lines
481 B
JavaScript
import rxjs from "../../lib/rx.js";
|
|
import ajax from "../../lib/ajax.js";
|
|
|
|
export function ls() {
|
|
return rxjs.pipe(
|
|
rxjs.mergeMap((path) => ajax({
|
|
url: `/api/files/ls?path=${path}`,
|
|
responseType: "json"
|
|
})),
|
|
rxjs.map(({ responseJSON }) => ({ files: responseJSON.results }))
|
|
);
|
|
}
|
|
|
|
function repeat(element, times) {
|
|
const result = Array(times);
|
|
for (let i = 0; i < times; i++) result[i] = element;
|
|
return result;
|
|
}
|