diff --git a/packages/siaviewnode-client/src/components/Dropzone.tsx b/packages/siaviewnode-client/src/components/Dropzone.tsx index 6162f2c6..f81d9217 100644 --- a/packages/siaviewnode-client/src/components/Dropzone.tsx +++ b/packages/siaviewnode-client/src/components/Dropzone.tsx @@ -8,7 +8,8 @@ import { CircularProgress } from "@material-ui/core" /** * nginx is setup to automatically handle and rewrite the url path. */ -const API_ENDPOINT = "/api" +const API_ENDPOINT = + process.env.NODE_ENV === "development" ? "http://localhost:4000" : "/api" const pName = R.prop("name") @@ -27,6 +28,7 @@ function MyDropzone() { fd.append("file", file) if (window) { const streamSaver = require("streamsaver") + console.log("streamSaver", streamSaver) const url = API_ENDPOINT + "/siafile" fetch(url, { method: "POST", @@ -67,7 +69,8 @@ function MyDropzone() { pump() }) .catch(e => { - setError(e) + // setError(e) + console.log("error is", e) setLoading(false) }) } diff --git a/packages/siaviewnode-server/src/main.ts b/packages/siaviewnode-server/src/main.ts index 73a500cc..168bb3f3 100644 --- a/packages/siaviewnode-server/src/main.ts +++ b/packages/siaviewnode-server/src/main.ts @@ -68,7 +68,6 @@ export class Server { const selectFile = R.path(["files", "file"]) try { const file: any = selectFile(req) - console.log("file is", req.files) const { data: stream } = await siad.post("/renter/stream", file.data, { headers: { @@ -80,14 +79,7 @@ export class Server { res.attachment(file.name) res.set("Content-Type", "application/octet-stream") - stream.on("data", chunk => { - console.log("chunk...") - res.write(chunk) - }) - stream.on("end", () => { - console.log("end...") - res.end() - }) + stream.pipe(res) } catch (e) { console.log("e is", e) return res.json({ error: e.message })