async-listen

`net.Server#listen()` helper that returns a Promise for async / await

MIT 11 个版本
安装
npm install async-listen
yarn add async-listen
pnpm add async-listen
bun add async-listen
README

async-listen

Promisify server.listen for your HTTP/HTTPS/TCP server.

Install

npm install async-listen

Usage

import listen from 'async-listen';
import { createServer } from 'http';

async function main() {
	const port = 3000;
	const server = createServer();
	const address = await listen(server, port);
	console.log(address); // => URL('http://127.0.0.1:3000')
}

main().catch(console.error);
版本列表
3.1.0 2025-02-11
3.0.1 2023-07-18
3.0.0 2023-05-05
2.1.0 2023-04-24
2.0.3 2023-03-28
2.0.2 2022-02-28
2.0.1 2022-02-28
1.2.0 2019-03-28
1.1.1 2019-02-08
1.1.0 2019-02-07
1.0.0 2016-10-28