惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
The Cloudflare Blog
G
Google Developers Blog
博客园_首页
Martin Fowler
Martin Fowler
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
D
Docker
C
Check Point Blog
T
Tailwind CSS Blog
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
GbyAI
GbyAI

Node.js

有深度使用 bunjs 的佬吗, rust 重写的 1.4 版本内存泄露解决了吗? - V2EX 告别 Django Admin!这个 NodeJS 全栈框架让你在 DTO 中直接配置 Table/Form 渲染 Bun 用 Rust 重写的 PR 已合并到主分支 TanStack 最新版本被投毒,病毒会盗密钥和报复性删除用户目录 Bun 从 Zig 到 Rust 的迁移已经实锤,下个版本可能成为最后一个 Zig 版本 bun 要从 zig 迁移 rust 了, 100 万刀被 claude 收购了,开始影响语言决策了 JS/Node 已经是新时代的 Java 了吧 Node.js 服务大部分时候连阿里云 Redis 是正常的,但是又时候会突然报 read ECONNRESET? 2026 年, node 写后端你用的 nestjs, fastify, honojs 还是其他? npmmirror 竟然有些包没有更新到最新版本 大家 typescript 下用的最多的是后端框架是哪个? 求助,大家 node.js 是怎么代理的 ai 时代, node.js 成为核心语言 NestJS + Swagger UI:非 200 状态码 Execute 时返回值不显示问题 深入 alova3 服务端能力:分布式 BFF 层到 API 网关的最佳实践 Anthropic 收购 Bun 关于 Node.js 中的事件循环问题。 Hoa - 一个极简 Web 框架 有没有 v 友遇到 windows10 丢失系统环境变量的问题 Esbuild 进程占用高 有没有推荐的 Nodejs 的 sass 多租户系统 2025 年 node 项目,乱成一锅粥的 typescript ESM import 写法该怎么选? [EvanNav 6.3.1] 如何删除加载页面,让 Nav 更符合你的需求⁉️ 删除 node_modules 文件夹非常耗时 Node.JS 作者 Ryan Dahl 的故事 Vona ORM 文档终于肝完了,欢迎拍砖 Node.js 官网更新了 adonisjs 有没有现成的注册登录库? 现在流行的 Node.js 做后台比传统的 Java .Net 有哪些优势? 现在大家开发 api 都用什么 node 框架?有没有想 rails 一样,功能齐全的框架?
请教大家一个在 hono.js 中使用 ts 的类型兼容性问题
Belmode · 2025-02-11 · via Node.js

我现在想在 node.js 平台上使用 hono.js ,现在需要实现一个文件下载需求


    //几个类型导入:
    import { stream } from "hono/streaming"
    import { Readable, Writable } from "node:stream"
    import { ReadableStream } from "node:stream/web"

	// ......
    const fileStream = createReadStream(filePath)
    // 将文件流作为响应返回给客户端
    return stream(
      c,
      async (stream) => {
        // Write a process to be executed when aborted.
        stream.onAbort(() => {
          console.log('Aborted!')
        })
        // Write a Uint8Array.
        await stream.write(
          new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f])
        )
        // Pipe a readable stream.
        // 这里出现了类型不兼容
        // await stream.pipe(Readable.toWeb(fileStream))
        await stream.pipe(ReadableStream.from(fileStream))
      },
      async (err, stream) => {
        // stream.writeln('An error occurred!')
        console.error('An error occurred!', err)
      }
    )

ts 提示: 类型“import("stream/web").ReadableStream<any>”的参数不能赋给类型“ReadableStream<any>”的参数. 属性“pipeThrough”的类型不兼容。

我该如何解决,或者说如何在 nodejs 环境使用...

谢谢大家了!🙇‍😘