本文整理汇总了TypeScript中@jonggrang/stream.pipeStream函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pipeStream函数的具体用法?TypeScript pipeStream怎么用?TypeScript pipeStream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pipeStream函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: randomString
return randomString(32).chain(filename => {
const finalPath = path.join(this.opts.dir, filename);
const outStream = fs.createWriteStream(finalPath);
return pipeStream(outStream, source as any).map(() =>
assign(file, {
filename,
size: outStream.bytesWritten,
path: finalPath,
move: handleMove
})
);
});
示例2: sendFilePath
export function sendFilePath(ws: ServerResponse, path: string, range: FileRange, hook: T.Task<void>): T.Task<void> {
const stream = pathCreateReadStream(path, range);
onFinished(ws, destroyStream.bind(null, stream));
return pipeStream(ws, stream as any, { end: false }).then(hook);
}
示例3: sendStream
export function sendStream(ws: ServerResponse, read: Readable): T.Task<void> {
onFinished(ws, destroyStream.bind(null, read));
return pipeStream(ws, read as any, { end: false });
}
示例4: sendFileFd
export function sendFileFd(ws: ServerResponse, fd: number, range: FileRange, hook: T.Task<void>): T.Task<void> {
const stream = fdcreateReadStream(fd, range);
return pipeStream(ws, stream as any, { end: false }).then(hook);
}