温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/docs/guides
点击访问原文链接
Guides - BunSkip to main contentBun home pageSearch...⌘KInstall BunSearch...NavigationOverviewGuidesRuntimePackage 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">OverviewGuidesDeploymentDeploy on VercelDeploy on RailwayDeploy on RenderDeploy on AWS LambdaDeploy on DigitalOceanDeploy on Google Cloud RunRuntime & DebuggingTypeScript typesRe-map import pathsVS Code debuggerWeb debuggerHeap snapshotsBuild-time constantsDefine constantsGitHub ActionsCodesign on macOSUtilitiesUpgrade BunDetect BunGet Bun versionHash passwordGenerate UUIDBase64 encodingGzip compressionDEFLATE compressionEscape HTMLDeep equalitySleepFile URL to pathPath to file URLFind executable pathimport.meta.dirimport.meta.fileimport.meta.pathCheck entrypointGet entrypoint pathEcosystem & FrameworksAstro with BunDiscord.js with BunDocker with BunDrizzle with BunGel with BunElysia with BunExpress with BunHono with BunMongoose with BunNeon Drizzle with BunNeon Serverless Postgres with BunNext.js with BunNuxt with BunPM2 with BunPrisma ORM with BunPrisma Postgres with BunQwik with BunReact with BunRemix with BunTanStack Start with BunSentry with BunSolidStart with BunSSR React with BunStricJS with BunSvelteKit with Bunsystemd with BunVite with BunUpstash with BunHTTP & NetworkingHTTP Server with BunSimple HTTP Server with BunFetch with BunHot reload an HTTP serverStart a cluster of HTTP serversConfigure TLSProxy HTTP requests using fetch()Stream file responseUpload files via HTTP using FormDataFetch with unix domain socketsStream with iteratorsStream with Node.jsWebSocketSimple serverPub-sub serverContextual dataEnable compressionProcesses & SystemSpawn child processRead stdoutRead stderrParse command-line argumentsRead from stdinSpawn a child process and communicate using IPCListen for CTRL+COS signalsProcess uptimeRun shell commandSet time zoneSet env variablesRead env variablesPackage ManagerAdd a dependencyAdd a dev dependencyAdd an optional dependencyAdd a peer dependencyAdd a Git dependencyAdd a tarball dependencyInstall with aliasWorkspaces with BunOverride the default npm registryConfigure a scoped registryAzure Artifacts with BunJFrog Artifactory with BunAdd a trusted dependencyGenerate a yarn-compatible lockfileMigrate from npm to bunConfigure git to diff Bun's lockfileInstall Bun in GitHub ActionsTest RunnerRun testsWatch modeMigrate from JestMock functionsSpy on methodsMock system timeSnapshot testingUpdate snapshotsCoverage reportsCoverage thresholdConcurrent test globSkip testsTodo testsTest timeoutBail earlyRe-run testsTesting LibraryDOM testsTest SvelteRuntime & DebuggingVS Code debuggerWeb debuggerHeap snapshotsBuild-time constantsDefine constantsGitHub ActionsCodesign on macOSModule SystemImport JSONImport TOMLImport YAMLImport JSON5Import HTMLimport.meta.dirimport.meta.fileimport.meta.pathCheck entrypointGet entrypoint pathFile SystemRead as stringRead to BufferRead to Uint8ArrayRead to ArrayBufferRead JSON fileGet MIME typeCheck file existsWatch directoryRead as streamWrite string to fileWrite BlobWrite ResponseAppend to fileIncremental writeWrite streamWrite to stdoutWrite file to stdoutCopy fileDelete fileDelete filesDelete directoriesUtilitiesHash passwordGenerate UUIDBase64 encodingGzip compressionDEFLATE compressionEscape HTMLDeep equalitySleepFile URL to pathPath to file URLFind executable pathHTML ProcessingExtract links using HTMLRewriterOpenGraph tagsBinary DataArrayBuffer to stringArrayBuffer to BufferArrayBuffer to BlobArrayBuffer to ArrayArrayBuffer to Uint8ArrayBuffer to stringBuffer to ArrayBufferBuffer to BlobBuffer to Uint8ArrayBuffer to ReadableStreamBlob to stringBlob to ArrayBufferBlob to Uint8ArrayBlob to DataViewBlob to ReadableStreamUint8Array to stringUint8Array to ArrayBufferUint8Array to BufferUint8Array to BlobUint8Array to DataViewUint8Array to ReadableStreamDataView to stringStreamsStream to stringStream to JSONStream to BlobStream to BufferStream to ArrayBufferStream to Uint8ArrayStream to arrayReadable to stringReadable to JSONReadable to BlobReadable to Uint8ArrayReadable to ArrayBufferOverviewGuidesCopy 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]">A collection of code samples and walkthroughs for performing common tasks with Bun.

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">FeaturedUse Tanstack Start with BunView guideUse Next.js with BunView guideBuild a frontend using Vite and BunView guideInstall TypeScript declarations for BunView guideWrite a simple HTTP serverView guideBuild a simple WebSocket serverView guideAll GuidesDeploymentDeploy Bun on VercelDeploy Bun on RailwayDeploy Bun on RenderBinary dataConvert an ArrayBuffer to an array of numbersConvert an ArrayBuffer to a BlobConvert an ArrayBuffer to a BufferConvert an ArrayBuffer to a stringConvert an ArrayBuffer to a Uint8ArrayConvert a Blob to an ArrayBufferConvert a Blob to a DataViewConvert a Blob to a ReadableStreamConvert a Blob to a stringConvert a Blob to a Uint8ArrayConvert a Buffer to an ArrayBufferConvert a Buffer to a blobConvert a Buffer to a ReadableStreamConvert a Buffer to a stringConvert a Buffer to a Uint8ArrayConvert a DataView to a stringConvert a Uint8Array to an ArrayBufferConvert a Uint8Array to a BlobConvert a Uint8Array to a BufferConvert a Uint8Array to a DataViewConvert a Uint8Array to a ReadableStreamConvert a Uint8Array to a stringEcosystemUse Gel with BunUse Prisma ORM with BunUse Prisma Postgres with BunCreate a Discord botAdd Sentry to a Bun appUse Drizzle ORM with BunBuild a React app with BunRun Bun as a daemon with PM2Build an app with Nuxt and BunBuild an app with Qwik and BunBuild an app with Astro and BunBuild an app with Remix and BunUse TanStack Start with BunRun Bun as a daemon with systemdBuild an app with Next.js and BunBuild an app with SvelteKit and BunBuild a frontend using Vite and BunBuild an app with SolidStart and BunUse Neon Postgres through Drizzle ORMBuild an HTTP server using Hono and BunUse Neon's Serverless Postgres with BunBuild an HTTP server using Elysia and BunContainerize a Bun application with DockerBuild an HTTP server using Express and BunServer-side render (SSR) a React componentBuild an HTTP server using StricJS and BunRead and write data to MongoDB using Mongoose and BunHTMLRewriterExtract links from a webpage using HTMLRewriterExtract social share images and Open Graph tagsHTTPCommon HTTP server usageHot reload an HTTP serverWrite a simple HTTP serverStart a cluster of HTTP serversConfigure TLS on an HTTP serverSend an HTTP request using fetchProxy HTTP requests using fetch()Stream a file as an HTTP ResponseUpload files via HTTP using FormDatafetch with unix domain sockets in BunStreaming HTTP Server with Async IteratorsStreaming HTTP Server with Node.js StreamsPackage managerAdd a dependencyAdd a Git dependencyAdd a peer dependencyAdd a tarball dependencyAdd a trusted dependencyAdd an optional dependencyAdd a development dependencyUsing bun install with ArtifactoryGenerate a yarn-compatible lockfileMigrate from npm install to bun installConfiguring a monorepo using workspacesInstall a package under a different nameConfigure git to diff Bun's lockb lockfileInstall dependencies with Bun in GitHub ActionsOverride the default npm registry for bun installUsing bun install with an Azure Artifacts npm registryConfigure a private registry for an organization scope with bun installProcessesRead from stdinListen for CTRL+CListen to OS signalsSpawn a child processParse command-line argumentsRead stderr from a child processRead stdout from a child processGet the process uptime in nanosecondsSpawn a child process and communicate using IPCReading filesRead a JSON fileCheck if a file existsRead a file to a BufferRead a file as a stringGet the MIME type of a fileRead a file to a Uint8ArrayRead a file to an ArrayBufferWatch a directory for changesRead a file as a ReadableStreamRuntimeDelete filesDelete directoriesImport a JSON fileImport a TOML fileImport a YAML fileRun a Shell CommandRe-map import pathsSet a time zone in BunSet environment variablesImport a HTML file as textRead environment variablesBuild-time constants with --defineDebugging Bun with the web debuggerInstall and run Bun in GitHub ActionsInstall TypeScript declarations for BunDebugging Bun with the VS Code extensionInspect memory usage using V8 heap snapshotsDefine and replace static globals & constantsCodesign a single-file JavaScript executable on macOSStreamsConvert a ReadableStream to JSONConvert a Node.js Readable to JSONConvert a ReadableStream to a BlobConvert a Node.js Readable to a BlobConvert a ReadableStream to a BufferConvert a ReadableStream to a stringConvert a Node.js Readable to a stringConvert a ReadableStream to a Uint8ArrayConvert a ReadableStream to an ArrayBufferConvert a Node.js Readable to an Uint8ArrayConvert a Node.js Readable to an ArrayBufferConvert a ReadableStream to an array of chunksTest runnerMock functions in bun testSpy on methods in bun testUsing Testing Library with BunUpdate snapshots in bun testRun tests in watch mode with BunUse snapshot testing in bun testBail early with the Bun test runnerSkip tests with the Bun test runnerMigrate from Jest to Bun's test runnerRun your tests with the Bun test runnerSet the system time in Bun's test runnerWrite browser DOM tests with Bun and happy-domSet a per-test timeout with the Bun test runnerMark a test as a "todo" with the Bun test runnerRe-run tests multiple times with the Bun test runnerSet a code coverage threshold with the Bun test runnerSelectively run tests concurrently with glob patternsGenerate code coverage reports with the Bun test runnerimport, require, and test Svelte components with bun testUtilitiesHash a passwordGenerate a UUIDEscape an HTML stringGet the current Bun versionEncode and decode base64 stringsCheck if two objects are deeply equalDetect when code is executed with BunGet the directory of the current fileGet the file name of the current fileConvert a file URL to an absolute pathCompress and decompress data with gzipConvert an absolute path to a file URLGet the path to an executable bin fileSleep for a fixed number of millisecondsCompress and decompress data with DEFLATEGet the absolute path of the current fileCheck if the current file is the entrypointGet the absolute path to the current entrypointWebSocketBuild a simple WebSocket serverEnable compression for WebSocket messagesBuild a publish-subscribe WebSocket serverSet per-socket contextual data on a WebSocketWriting filesDelete a fileWrite to stdoutWrite a Blob to a fileWrite a file to stdoutAppend content to a fileWrite a string to a fileWrite a file incrementallyWrite a Response to a fileCopy a file to another locationWrite a ReadableStream to a file

Was this page helpful?

YesNoSuggest editsRaise issueDeploy a Bun application on VercelNext⌘IxgithubdiscordyoutubePowered by

智能索引记录