MCPcopy Create free account
hub / github.com/totaljs/framework / fsStreamRead

Function fsStreamRead

index.js:18860–18886  ·  view source on GitHub ↗
(filename, options, callback, res)

Source from the content-addressed store, hash-verified

18858}
18859
18860function fsStreamRead(filename, options, callback, res) {
18861
18862 if (!callback) {
18863 callback = options;
18864 options = undefined;
18865 }
18866
18867 var opt;
18868
18869 if (options) {
18870
18871 opt = HEADERS.fsStreamReadRange;
18872 opt.start = options.start;
18873 opt.end = options.end;
18874
18875 if (opt.start > opt.end)
18876 delete opt.end;
18877
18878 } else
18879 opt = HEADERS.fsStreamRead;
18880
18881 U.queue('F.files', CONF.default_maxopenfiles, function(next) {
18882 var stream = Fs.createReadStream(filename, opt);
18883 stream.on('error', NOOP);
18884 callback(stream, next, res);
18885 }, filename);
18886}
18887
18888/**
18889 * Prepare URL address to temporary key (for caching)

Callers 2

extend_responseFunction · 0.85
$file_rangeFunction · 0.85

Calls 1

callbackFunction · 0.85

Tested by

no test coverage detected