當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript PassThrough.end方法代碼示例

本文整理匯總了TypeScript中stream.PassThrough.end方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PassThrough.end方法的具體用法?TypeScript PassThrough.end怎麽用?TypeScript PassThrough.end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stream.PassThrough的用法示例。


在下文中一共展示了PassThrough.end方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _shutdown

 private _shutdown() {
   // End the temporary streams so the merged streams end too
   if (this._fakeStream) {
     this._fakeStream.end();
     this._fakeStream = null;
   }
 }
開發者ID:Volune,項目名稱:jest,代碼行數:7,代碼來源:ChildProcessWorker.ts

示例2: rp

    rp(options).then(response => {

      const stream = require('stream');
      const bufferStream = new stream.PassThrough();

      bufferStream.end(Buffer.from(response.body, 'base64'));

      const file = admin.storage().bucket().file('name.jpg');

      bufferStream.pipe(
        file.createWriteStream({
          public: true
        }))
        .on('error', function(error) {
          console.log(error);
          return res.status(500).send(error);
        })
        .on('finish', function() {

          const config: GetSignedUrlConfig = {
            action: 'read',
            expires: '01-01-2025'
          };
          file.getSignedUrl(config, function(error, url) {
            console.log(url);
            if (error) {
              return res.status(500).send(error);
            }
            return res.status(500).send(url);
          });

        });

      res.send('Success');
    })
開發者ID:Meistercoach83,項目名稱:sfw,代碼行數:35,代碼來源:get-unsplash-item.ts

示例3: async

async () => {
    const s = new PassThrough();
    s.write('howdy');
    s.end();
    const { stdout } = await execa('stdin', { input: s });
    assert(stdout === 'foobar');
};
開發者ID:CNBoland,項目名稱:DefinitelyTyped,代碼行數:7,代碼來源:execa-tests.ts

示例4: it

 it('produces multiple chunks from a fed stream', () => {
   const str = new stream.PassThrough({highWaterMark: 1024});
   const src = Source.fromInputStream(() => str);
   const data1 = new Buffer(1024);
   const data2 = new Buffer(1024);
   str.write(data1);
   str.write(data2);
   str.end();
   return chai.expect(src.toArray()).to.eventually.deep.equal([data1, data2]);
 });
開發者ID:srijs,項目名稱:node-pacific,代碼行數:10,代碼來源:source-spec.ts

示例5: it

    it('DeleteLayer Test -', (done: () => void) => {
		var response = new PassThrough();
		response.write(JSON.stringify({'statusCode': '202'}));        
		response.end();
        var req = new PassThrough();
        this.request.callsArgWith(1,response).returns(req);
        wrapper.deleteLayer('name','digest',(err)=>{  
            done();
        });
    });
開發者ID:beverts312,項目名稱:docker-registry-cli,代碼行數:10,代碼來源:registry-wrapper-tests.ts

示例6: it

 it('should be pipeable', () => {
   const msg = 'hello world!';
   const wsb = new WritableStreamBuffer();
   const rs = new PassThrough();
   rs.pipe(wsb);
   rs.write(msg);
   rs.end();
   const result = wsb.consume();
   expect(result.toString()).toEqual(msg);
 });
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:10,代碼來源:index.ts

示例7: it

 it('fails when the sink onStart fails', () => {
   const str = new stream.PassThrough({highWaterMark: 1024});
   const src = Source.fromInputStream(() => str);
   const err = new Error('yep this is an error');
   str.end(new Buffer(1024));
   const promise = src.pipe<void, void>({
     onStart: () => Task.throwError<void>(err),
     onData: () => Task.unit(),
     onEnd: () => Task.unit()
   }).exec();
   return chai.expect(promise).to.eventually.be.rejectedWith(err);
 });
開發者ID:lukiano,項目名稱:node-aff,代碼行數:12,代碼來源:source-spec.ts


注:本文中的stream.PassThrough.end方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。