Spaces:
Paused
Paused
Download src/addon/server.ts from no1b4me/hytranslator: direct link, hf CLI and curl.
- Browser
- Download file 604 Bytes
-
https://huggingface.co/spaces/no1b4me/hytranslator/resolve/main/src/addon/server.ts
- Command line
-
hf download hf://spaces/no1b4me/hytranslator/src/addon/server.ts
-
curl -L -o server.ts https://huggingface.co/spaces/no1b4me/hytranslator/resolve/main/src/addon/server.ts
604 Bytes
| import { Application } from "express"; | |
| import stremio from "stremio-addon-sdk"; | |
| import { streamHandler } from "./streams.js"; | |
| import { manifest } from "./manifest.js"; | |
| import { Server } from "http"; | |
| export const serveHTTP = async (port: number) => { | |
| const builder = new stremio.addonBuilder(manifest); | |
| // @ts-ignore | |
| builder.defineStreamHandler(streamHandler); | |
| const addonInterface = builder.getInterface(); | |
| // @ts-ignore | |
| const { | |
| url, | |
| server, | |
| app, | |
| }: { url: string; server: Server; app: Application } = | |
| await stremio.serveHTTP(addonInterface, { port }); | |
| return app; | |
| }; | |