All Projects → random-access-storage → Random Access Http

random-access-storage / Random Access Http

Licence: isc
Continuous reading from a http(s) url using random offsets and lengths for peers in a distributed system

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Random Access Http

Hyperfeed
decentralized rss publishing
Stars: ✭ 60 (+53.85%)
Mutual labels:  dat, p2p
Hypercloud
A hosting server for Dat. [ARCHIVED - Use Hashbase instead!]
Stars: ✭ 96 (+146.15%)
Mutual labels:  dat, p2p
Datradio
p2p music player for {old} beaker and dat
Stars: ✭ 77 (+97.44%)
Mutual labels:  dat, p2p
Dat Keyserver
a distributed PGP keyserver project based on the dat protocol
Stars: ✭ 89 (+128.21%)
Mutual labels:  dat, p2p
dat-workshop
How to build web apps using Dat. A workshop by GEUT.
Stars: ✭ 50 (+28.21%)
Mutual labels:  dat, p2p
Datr
R package to interface with the decentralized dat network.
Stars: ✭ 56 (+43.59%)
Mutual labels:  dat, p2p
Dat React Native
Browse through the web with the Dat protocol in your device!
Stars: ✭ 25 (-35.9%)
Mutual labels:  dat, p2p
Hyperdb Examples
a small introduction to getting started with hyperdb
Stars: ✭ 53 (+35.9%)
Mutual labels:  dat, p2p
Datbase
[DEPRECATED] Open data sharing powered by Dat
Stars: ✭ 251 (+543.59%)
Mutual labels:  dat, p2p
Enoki
ultralight tools for creating p2p sites
Stars: ✭ 222 (+469.23%)
Mutual labels:  dat, p2p
Sdk
Write your own dat app!
Stars: ✭ 215 (+451.28%)
Mutual labels:  dat, p2p
Dathttpd
Replaced by Homebase! See https://github.com/beakerbrowser/homebase.
Stars: ✭ 282 (+623.08%)
Mutual labels:  dat, p2p
paperslip
share hard-to-transmit snippets with easy-to-pronounce names using dht magic
Stars: ✭ 37 (-5.13%)
Mutual labels:  dat, p2p
Sciencefair
The futuristic, fabulous and free desktop app for working with scientific literature 🔬 📖
Stars: ✭ 561 (+1338.46%)
Mutual labels:  dat, p2p
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+21435.9%)
Mutual labels:  p2p
Viraljs
Express.JS middleware to enable P2P distribution for your app. Your decentralized CDN made easy.
Stars: ✭ 952 (+2341.03%)
Mutual labels:  p2p
Peer Calls
Group peer to peer video calls for everyone written in Go and TypeScript
Stars: ✭ 837 (+2046.15%)
Mutual labels:  p2p
Ipchain
IPChain Core Wallet
Stars: ✭ 26 (-33.33%)
Mutual labels:  p2p
Pulsarcast
A pub-sub system for the distributed web - my master thesis @ IST
Stars: ✭ 33 (-15.38%)
Mutual labels:  p2p
Waggle.js
An experiment to distribute the bandwidth among video viewers
Stars: ✭ 29 (-25.64%)
Mutual labels:  p2p

random-access-http

Continuous reading from a http(s) url using random offsets and lengths

npm install random-access-http

Build Status Coverage Status

Why?

Peers in a distributed system tend to come and go over a short period of time in many common p2p scenarios, especially when you are giving away a file without incentivizing the swarm to seed the file for a long time. There are also an abundance of free cloud hosts that let you host large files over http.

This module provides you random access to a file hosted over http so that it can be used by a client in a distributed system (such as hypercore or hyperdrive) to acquire parts of the file for itself and the other peers in the swarm.

Usage

var randomAccessHTTP = require('random-access-http')

var file = randomAccessHTTP('http://example.com/somefile.mp4')

// Read 10 bytes at an offset of 5
file.read(5, 10, function(err, buffer) {
  console.log(buffer)
  file.close(function() {
    console.log('http keepalive agents and sockets destroyed')
  })
})

file will use a keepalive agent to reduce the number http requests needed for the session. When you are done you should call file.close() to destroy the agent.

API

var file = randomAccessHTTP(url, [options])

Create a new 'file' that reads from the provided url. The url can be either http, https or a relative path if url is set in options.

Options include:

{
  url: string // Optionsal. The base url if first argument is relative
  verbose: boolean, // Optional. Default: false.
  timeout: number, // Optional. Default: 60000
  maxRedirects: number, // Optional. Default: 10
  maxContentLength: number, // Optional. Default: 50MB
  strict: true, // When false, will accept non-ranged response (it will slice the response to the requested offset/length)
}

file.write(offset, buffer, [callback])

Not implemented! Please let us know if you have opinions on how to implement this. This will silently fail with no data being writen.

file.read(offset, length, callback)

Read a buffer at a specific offset. Callback is called with the buffer read. By default, this will fail if the server returns byte ranges different than what is requested. If you want to support uncooperative static file servers (that doesn't use ranges), pass the strict with a falsy value.

file.close([callback])

Close outstanding http keepalive agent sockets.

file.on('open')

Emitted when the url has been checked to support range requests and the keep-alive agent has been created.

file.on('close')

Emitted after the keepalive agent and its associated sockets have been destroyed.

See Also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].