path-source
A readable stream reader for reading files in Node or fetching URLs in browser. For example, to read a file in Node:
var path = ; ;
Similarly, to fetch a resource in a browser (requires array-source if streaming fetch is not supported):
API Reference
In Node, returns a Promise that yields a source for the file at the specified path; equivalent to file-source. In a browser, returns a Promise that yields a source for the resource at the specified path URL, using streaming fetch if available, and falling back to a binary data XMLHttpRequest.
In Node, the following options are supported:
highWaterMark
- the stream’s internal buffer size; defaults to 65,536
In a browser, no options are currently supported.
Returns a Promise for the next chunk of data from the underlying stream. The yielded result is an object with the following properties:
value
- a Uint8Array (a Buffer), or undefined if the stream endeddone
- a boolean which is true if the stream ended
Returns a Promise which is resolved when the underlying stream has been destroyed.