random-read-http

1.0.9 • Public • Published

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

Package Sidebar

Install

npm i random-read-http

Weekly Downloads

3

Version

1.0.9

License

MIT

Unpacked Size

11.2 kB

Total Files

7

Last publish

Collaborators

  • 131
  • frodon