0.16.0 • Published 5 years ago

fibridge-host v0.16.0

Weekly downloads
12
License
MIT
Repository
-
Last release
5 years ago

The point of fibridge (FIle BRIDGE) is to allow your browser to "host" files which can be streamed over HTTP. This requires a proxy server to handle the HTTP requests and forward them to the browser over websockets. The proxy server lives here.

Why would this be useful? If the user has a very large file (genomic data files can easily be in the 20GB-200GB range), and you want to make ranged requests to that file (ie only download specific chunks) as though it were hosted on a normal server, fibridge provides this functionality.

NOTE: This is an early work in progress and not quite ready to be used for in production.

Example usage

First install the proxy server:

npm install -g fibridge-proxy

And run it:

fibridge-proxy -p 8080

Create a Hoster object in the browser and host a couple files. See dist/index.html for a working example where the user selects a file from their computer.

fibridge.createHoster({ proxyAddress: 'localhost', port: 8080, secure: false }).then((hoster) => {

  const file1 = new File(["Hi there"], "file1.txt", {
    type: "text/plain",
  });
  
  const file2 = new File(["I'm Old Gregg"], "file2.txt", {
    type: "text/plain",
  });
  
  hoster.hostFile({ path: '/file1', file: file1 });
  hoster.hostFile({ path: '/file2', file: file2 });
});

Retrieve the files using any http client:

curl localhost:8080/file1
Hi there
curl localhost:8080/file2
I'm Old Gregg

Ranged requests work too:

curl -H "Range: bytes=0-2" localhost:8080/file1
Hi
0.16.0

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.0

6 years ago

0.8.2

6 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago