Skip to content

131/random-read-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Version License Code style

Motivation

This module allows you to open an http(s) url and read through it at random offsets (seeking). This is usefull when working with pseudo-fs like cloudfs.

It's optimized for speed and efficiency, using http(s) agent & http 1.1 polling & a read-ahead buffer list to control the flow and minimize round-trips.

API / usage

const RandomReadHTTP = require('random-read-http');

let remote = new RandomReadHTTP("https://someurl/somefile.mkv");

remote.read(buf, 0, 10, function(len) {
  console.log("Got 10 first bytes into", buf);
  remote.close(); //free up http agent
});

constructor(remote_url [, options])

Options are :

  • MAX_BL_SIZE (default to 20MB). flow will be paused when internal buffer reach MAX_BL_SIZE limit.
  • MIN_BL_SIZE (default to 2.5MB). flow will be resumed if internal buffer is lower than MIN_BL_SIZE.

Credits / inspiration

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published