How to use already - 7 common examples

To help you get started, we’ve selected a few already examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github grantila / fetch-h2 / test / fetch-h2 / index.ts View on Github external
it( 'should be possible to POST not yet ended stream-data', async ( ) =>
	{
		const stream = through2( );

		const eventual_response = fetch(
			'https://nghttp2.org/httpbin/post',
			{
				method: 'POST',
				body: new StreamBody( stream ),
				headers: { 'content-length': '6' },
			}
		);

		await delay( 1 );

		stream.write( "foo" );
		stream.write( "bar" );
		stream.end( );

		const response = await eventual_response;

		const data = await response.json( );
		expect( data.data ).to.equal( "foobar" );
	} );
github grantila / fetch-h2 / test / fetch-h2 / httpbin.ts View on Github external
return async ( ) =>
		{
			const { fetch, disconnectAll } = context( {
				httpsProtocols: protos,
			} );

			await fn( fetch ).then( ...Finally( disconnectAll ) );
		};
	}
github grantila / fetch-h2 / test / fetch-h2 / httpbin.ts View on Github external
wrapContext( async ( fetch ) =>
	{
		const stream = through2( );

		const eventualResponse = fetch(
			`${host}/post`,
			{
				allowForbiddenHeaders: true,
				body: new StreamBody( stream ),
				headers: { "content-length": "6" },
				method: "POST",
			}
		);

		await delay( 1 );

		stream.write( "foo" );
		stream.write( "bar" );
		stream.end( );

		const response = await eventualResponse;

		const data = await response.json( );
		expect( data.data ).toBe( "foobar" );
	} ) );
github grantila / fetch-h2 / dist / lib / fetch.js View on Github external
});
            if (!endStream)
                await req.readable()
                    .then(readable => {
                    readable.pipe(stream);
                });
            return response;
        });
    }
    return Promise.race([
        signalPromise,
        timeoutInfo && timeoutInfo.promise,
        doFetch(),
    ]
        .filter(promise => promise))
        .then(...already_1.Finally(cleanup));
}
function fetch(session, input, init) {
github grantila / fetch-h2 / dist / lib / body.js View on Github external
async json() {
        this._ensureUnused();
        if (this._body == null)
            return Promise.resolve(this.validateIntegrity(emptyBuffer, false))
                .then(() => this._body);
        else if (isStream(this._body))
            return get_stream_1.buffer(this._body)
                .then(already_1.tap(buffer => this.validateIntegrity(buffer, false)))
                .then(buffer => JSON.parse(buffer.toString()));
        else if (isBuffer(this._body))
            return Promise.resolve(this._body)
                .then(already_1.tap(buffer => this.validateIntegrity(buffer, false)))
                .then(buffer => JSON.parse(buffer.toString()));
        else
            throwUnknownData();
    }
    async text(allowIncomplete = false) {
github grantila / fetch-h2 / dist / lib / body.js View on Github external
async text(allowIncomplete = false) {
        this._ensureUnused();
        if (this._body == null)
            return Promise.resolve(this.validateIntegrity(emptyBuffer, allowIncomplete))
                .then(() => this._body);
        else if (isStream(this._body))
            return get_stream_1.buffer(this._body)
                .then(already_1.tap(buffer => this.validateIntegrity(buffer, allowIncomplete)))
                .then(buffer => buffer.toString());
        else if (isBuffer(this._body))
            return Promise.resolve(this._body)
                .then(already_1.tap(buffer => this.validateIntegrity(buffer, allowIncomplete)))
                .then(buffer => buffer.toString());
        else
            return throwUnknownData();
    }
    async readable() {
github phingofficial / phing / docs / docbook5 / en / output / webhelp / search / index-1.js View on Github external
w["allowedhtml"]="451*1";
w["allowedserv"]="93*2,103*1,238*1";
w["allowencodingintosourc"]="238*1";
w["allowti"]="218*2";
w["allremot"]="133*1,159*1";
w["alltest"]="405*1";
w["alltests.php"]="405*1";
w["almost"]="185*1";
w["alon"]="178*1";
w["along"]="42*3,133*1,201*1,402*1";
w["alpha"]="377*2";
w["alphabet"]="446*1,453*1";
w["alphanumer"]="62*1";
w["alr"]="15*1";
w["alreadi"]="33*1,42*3,69*1,87*1,130*1,195*1,221*2,282*1,301*1,388*1,402*1,411*1,417*1,509*1";
w["already."]="221*1";
w["also"]="13*1,15*1,21*1,26*1,31*1,36*1,42*10,60*1,70*1,73*1,86*1,130*1,138*2,146*1,155*1,158*1,160*1,167*1,175*1,184*3,185*1,201*1,203*1,206*1,217*1,218*1,226*1,236*1,237*2,246*1,250*1,282*1,291*1,306*1,313*1,324*1,328*1,333*1,354*1,366*1,402*5,403*1,414*1,430*1,443*1,460*2,472*3,478*1,501*1,507*1,515*1,521*1";
w["alter"]="42*2,334*1";
w["alteration."]="334*1";
w["altern"]="15*1,42*1,154*2,354*1,486*1";
w["alternativebuild"]="419*1";
w["alternativebuild.xml"]="419*1";
w["alternativebuildfil"]="419*1";
w["alternativebuildfile.xml"]="419*1";
w["although"]="42*1";
w["alway"]="35*1,43*1,65*1,109*1,121*2,138*2,197*1,227*1,232*1,240*1,335*1,340*1,382*1,390*1,395*1,471*1,499*1";
w["am"]="55*1,136*1,140*1,254*1,285*1";
w["amazon"]="175*3,191*6,253*6,472*9";
w["amazon.bucket"]="175*1,191*1,253*1,472*3";
w["amazon.key"]="175*1,191*1,253*1,472*3";
w["amazon.secret"]="175*1,191*1,253*1,472*3";
w["amazonkey"]="175*1,472*1";

already

Promise extensions; map, filter, etc

MIT
Latest version published 1 year ago

Package Health Score

51 / 100
Full package analysis