
pull(
self.getPullStream(ipfsPath, options),
pull.asyncMap((file, cb) => {
if (file.content) {
pull(
file.content,
pull.collect((err, buffers) => {
if (err) { return cb(err) }
file.content = Buffer.concat(buffers)
cb(null, file)
})
)
} else {
cb(null, file)
}
}),
pull.collect(callback)
)
上篇著述的实质,咱们回忆到这里就边界了,底下咱们仔细探究 streamBytes 函数及联系的深度遍历是奈何完毕的。streamBytes 函数使用了 pull-traverse 类库提供深度优先、广度优先、叶子优先等算法,乐鱼炸金花它的每个算法王人复返一个 pull 类库的 through 流,这个流被它背面的流所调用。在这里使用深度优先算法,复返的流被 pull 类库的 map 流所调用,用于取得每一个元素。
光辉皇冠足球源码深度优先算法的联系代码如下:
var once = exports.once =
function (value) {
return function (abort, cb) {
if(abort) return cb(abort)
if(value != null) {
var _value = value; value = null
cb(null, _value)
} else
cb(true)
}
}var depthFirst = exports.depthFirst =
function (start, createStream) {
var reads = [], ended
reads.unshift(once(start))
“黄沙漫漫风打边,劲草低头丘连绵。明月空照百里溪,抬头南望北飞雁。”这里是新疆鄯善,一段奇缘开始的地方……
188金宝博登录 return function next (end, cb) {
if(!reads.length)
return cb(true)
if(ended)
return cb(ended)
博彩世界是一个充满刺激和惊喜的地方。在皇冠体育,您可以享受到世界上最好的博彩游戏和体育博彩活动。无论您是喜欢在赛马场上下注还是喜欢玩老虎机,我们都有最好的游戏供您选择。您甚至可以在我们的扑克房里挑战全球顶尖的扑克玩家。加入皇冠体育,您将会享受到博彩的魅力和无限乐趣!
皇冠客服飞机:@seo3687 reads[0](end, function (end, data) {
if(end) {
if(end !== true) {
ended = end
reads.shift()
while(reads.length)
reads.shift()(end, function () {})
北京赛车娱乐城皇冠现金 return cb(end)
}
皇冠hg86a
reads.shift()
return next(null, cb)
}
皇冠足球源码 reads.unshift(createStream(data))
cb(end北京赛车现金网, data)
})
}
}
streamBytes 函数界说在 file.js 文献中,咱们来看下它的实质:
function streamBytes (dag, node, fileSize, offset, length) {
if (offset === fileSize

