How to use @szmarczak/http-timer - 1 common examples

To help you get started, we’ve selected a few @szmarczak/http-timer 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 sindresorhus / got / source / request-as-event-emitter.ts View on Github external
// Check if it's caught by `stream.pipeline(...)`
					if (!isFinished) {
						return;
					}

					// We need to let `TimedOutTimeoutError` through, because `stream.pipeline(…)` aborts the request automatically.
					if (isAborted() && !(error instanceof TimedOutTimeoutError)) {
						return;
					}
				}

				onError(error);
			});

			try {
				timer(request);
				timedOut(request, options.timeout, options.url);

				emitter.emit('request', request);

				const uploadStream = createProgressStream('uploadProgress', emitter, httpOptions.headers!['content-length'] as string);

				isPiped = true;

				await pipeline(
					httpOptions.body!,
					uploadStream,
					request
				);

				request.emit('upload-complete');
			} catch (error) {

@szmarczak/http-timer

Timings for HTTP requests

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Popular @szmarczak/http-timer functions