Buckets:
| import { FileSystem } from "@opencode-ai/core/filesystem" | |
| import { RelativePath } from "@opencode-ai/core/schema" | |
| import { Effect } from "effect" | |
| import { HttpServerResponse } from "effect/unstable/http" | |
| import { HttpApiBuilder } from "effect/unstable/httpapi" | |
| import { Api } from "../api" | |
| import { response } from "../groups/location" | |
| export const FileSystemHandler = HttpApiBuilder.group(Api, "server.fs", (handlers) => | |
| Effect.gen(function* () { | |
| return handlers | |
| .handleRaw("fs.read", (ctx) => | |
| Effect.gen(function* () { | |
| const file = yield* (yield* FileSystem.Service).read({ | |
| path: RelativePath.make( | |
| decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)), | |
| ), | |
| }) | |
| return HttpServerResponse.uint8Array(file.content, { contentType: file.mime }) | |
| }), | |
| ) | |
| .handle("fs.list", (ctx) => | |
| response( | |
| Effect.gen(function* () { | |
| const fs = yield* FileSystem.Service | |
| return yield* fs.list(ctx.query) | |
| }), | |
| ), | |
| ) | |
| .handle("fs.find", (ctx) => | |
| response( | |
| Effect.gen(function* () { | |
| const fs = yield* FileSystem.Service | |
| return yield* fs.find(ctx.query) | |
| }), | |
| ), | |
| ) | |
| }), | |
| ) | |
Xet Storage Details
- Size:
- 1.32 kB
- Xet hash:
- af0f729dd2033258cdf8450400e2b0b3bd92af998c8fc13d7f674608577303fe
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.