本文整理匯總了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();
}