UNPKG

1.68 kBTypeScriptView Raw
1/*!
2 * Copyright 2019 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/// <reference types="node" />
17import { Transform, Writable } from 'stream';
18import { ParsedArguments } from './';
19interface ResourceEvents<T> {
20 addListener(event: 'data', listener: (data: T) => void): this;
21 emit(event: 'data', data: T): boolean;
22 on(event: 'data', listener: (data: T) => void): this;
23 once(event: 'data', listener: (data: T) => void): this;
24 prependListener(event: 'data', listener: (data: T) => void): this;
25 prependOnceListener(event: 'data', listener: (data: T) => void): this;
26 removeListener(event: 'data', listener: (data: T) => void): this;
27}
28export declare class ResourceStream<T> extends Transform implements ResourceEvents<T> {
29 _ended: boolean;
30 _maxApiCalls: number;
31 _nextQuery: {} | null;
32 _otherArgs: unknown[];
33 _reading: boolean;
34 _requestFn: Function;
35 _requestsMade: number;
36 _resultsToSend: number;
37 constructor(args: ParsedArguments, requestFn: Function);
38 end(...args: any[]): ReturnType<Writable['end']> extends Writable ? this : void;
39 _read(): void;
40}
41export {};