温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/docs/runtime/bun-apis
点击访问原文链接

Bun APIs - Bun

Bun APIs - BunSkip to main contentBun home pageSearch...⌘KInstall BunSearch...NavigationStandards & CompatibilityBun APIsRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedbackdiv:first-child]:!hidden peer-[.is-custom]:[&>div:first-child]:sm:!hidden peer-[.is-custom]:[&>div:first-child]:md:!hidden peer-[.is-custom]:[&>div:first-child]:lg:!hidden peer-[.is-custom]:[&>div:first-child]:xl:!hidden">Get StartedWelcome to BunInstallationQuickstartTypeScriptbun initbun createCore RuntimeBun RuntimeWatch ModeDebuggingREPLbunfig.tomlFile & Module SystemFile TypesModule ResolutionJSXAuto-installPluginsFile System RouterHTTP serverServerRoutingCookiesTLSError HandlingMetricsNetworkingFetchWebSocketsTCPUDPDNSData & StorageCookiesFile I/OStreamsBinary DataArchiveSQLSQLiteS3RedisConcurrencyWorkersProcess & SystemEnvironment VariablesShellSpawnInterop & ToolingNode-APIFFIC CompilerTranspilerUtilitiesSecretsConsoleYAMLMarkdownJSON5JSONLHTMLRewriterHashingGlobSemverColorUtilsStandards & CompatibilityGlobalsBun APIsWeb APIsNode.js CompatibilityContributingRoadmapBenchmarkingContributingBuilding WindowsBindgenLicenseStandards & CompatibilityBun APIsCopy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_2shjinpfd9rqaabsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">*]:[overflow-wrap:anywhere]">Overview of Bun’s native APIs available on the Bun global object and built-in modules

Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_5hjinpfd9rqaabsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">Bun implements a set of native APIs on the Bun global object and through a number of built-in modules. These APIs are heavily optimized and represent the canonical “Bun-native” way to implement some common functionality. Bun strives to implement standard Web APIs wherever possible. Bun introduces new APIs primarily for server-side tasks where no standard exists, such as file I/O and starting an HTTP server. In these cases, Bun’s approach still builds atop standard APIs like Blob, URL, and Request. server.tsCopyBun.serve({ fetch(req: Request) { return new Response("Success!"); }, }); Click the link in the right column to jump to the associated documentation. TopicAPIsHTTP ServerBun.serveShell$BundlerBun.buildFile I/OBun.file, Bun.write, Bun.stdin, Bun.stdout, Bun.stderrChild ProcessesBun.spawn, Bun.spawnSyncTCP SocketsBun.listen, Bun.connectUDP SocketsBun.udpSocketWebSocketsnew WebSocket() (client), Bun.serve (server)TranspilerBun.TranspilerRoutingBun.FileSystemRouterStreaming HTMLHTMLRewriterHashingBun.password, Bun.hash, Bun.CryptoHasher, Bun.shaSQLitebun:sqlitePostgreSQL ClientBun.SQL, Bun.sqlRedis (Valkey) ClientBun.RedisClient, Bun.redisFFI (Foreign Function Interface)bun:ffiDNSBun.dns.lookup, Bun.dns.prefetch, Bun.dns.getCacheStatsTestingbun:testWorkersnew Worker()Module LoadersBun.pluginGlobBun.GlobCookiesBun.Cookie, Bun.CookieMapNode-APINode-APIimport.metaimport.metaUtilitiesBun.version, Bun.revision, Bun.env, Bun.mainSleep & TimingBun.sleep(), Bun.sleepSync(), Bun.nanoseconds()Random & UUIDBun.randomUUIDv7()System & EnvironmentBun.which()Comparison & InspectionBun.peek(), Bun.deepEquals(), Bun.deepMatch, Bun.inspect()String & Text ProcessingBun.escapeHTML(), Bun.stringWidth(), Bun.indexOfLineURL & Path UtilitiesBun.fileURLToPath(), Bun.pathToFileURL()CompressionBun.gzipSync(), Bun.gunzipSync(), Bun.deflateSync(), Bun.inflateSync(), Bun.zstdCompressSync(), Bun.zstdDecompressSync(), Bun.zstdCompress(), Bun.zstdDecompress()Stream ProcessingBun.readableStreamTo*(), Bun.readableStreamToBytes(), Bun.readableStreamToBlob(), Bun.readableStreamToFormData(), Bun.readableStreamToJSON(), Bun.readableStreamToArray()Memory & Buffer ManagementBun.ArrayBufferSink, Bun.allocUnsafe, Bun.concatArrayBuffersModule ResolutionBun.resolveSync()Parsing & FormattingBun.semver, Bun.TOML.parse, Bun.markdown, Bun.colorLow-level / InternalsBun.mmap, Bun.gc, Bun.generateHeapSnapshot, bun:jsc

Was this page helpful?

YesNoSuggest editsRaise issueGlobalsPreviousWeb APIsNext⌘IxgithubdiscordyoutubePowered by

智能索引记录