本文整理汇总了TypeScript中fs.ReadStream类的典型用法代码示例。如果您正苦于以下问题:TypeScript ReadStream类的具体用法?TypeScript ReadStream怎么用?TypeScript ReadStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReadStream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: store
store(fileid: any, datastream: ReadStream, callback) {
const outfile = createWriteStream(join(this.storeDir, `${fileid}.enc`));
let out = datastream.pipe(outfile);
out.once('error', function(err){
return callback(err);
});
out.once('close', function(){
return callback();
});
}
示例2: stream
/**
* Starts streaming.
*
* @param {Boolean} [strict] Whether or not to be a jerk. Default: false.
* @param {{ trim: Boolean, normalize: Boolean, lowercase: Boolean, xmlns: Boolean, position: Boolean, strictEntities: Boolean }} [options] Options
* @returns {Stream}
*/
public stream(strict: boolean, options?: any) {
this.readStream = createReadStream(this.filename);
return this.readStream.pipe(this.createStream(strict, options));
}
示例3: resume
/**
* Resumes a paused stream.
*/
public resume() {
this.paused = false;
while (this.stack.length > 0 && !this.paused) {
const e = this.stack.shift();
this.emit(e.name, e.data);
}
if (this.stack.length === 0) {
this.readStream.resume();
}
}
示例4: pause
/**
* Pauses the stream. No further events will be submitted
* until {@link #resume()} is called.
*/
public pause() {
this.paused = true;
this.readStream.pause();
}