

目前客户端下载某个文件需要客户端进行限速,客户端下载类的实现使用 DownloadItem https://www.electronjs.org/zh/docs/latest/api/download-item 查找相关的一些 api 发现: https://www.electronjs.org/docs/latest/api/session#sesenablenetworkemulationoptions
win.webContents.session.enableNetworkEmulation({
latency: 500,
downloadThroughput: 6400,
uploadThroughput: 6400
})
但是添加一直没有效果,没有起作用,我们使用的 Electron 版本是 24.8.8 ,查找官方 issue
https://github.com/electron/electron/issues/21250 怀疑和这个相关,下面有个哥们有这个方案,我也尝试发现 dbg.sendCommand('Network.enable') 这里这里报错了,try catch 跳出了
const dbg = myWebContents.debugger
dbg.attach()
await dbg.sendCommand('Network.enable')
await dbg.sendCommand('Network.emulateNetworkConditions', {offline: true, latency: 0, downloadThroughput: -1, uploadThroughput: -1})
所以想了解下有木有其他客户端伙伴实现过相关的方案,我也考虑过其他一些方案
1.升级 Electron 版本,addon 和一些语法需要适配
2. 使用 node-libcur ,两套下载类需要统一 这两种代码的改动都会稍微大一点
IT之家 4 月 11 日消息,九号公司今日发布公告,2024 年营业收入 141.96 亿元,同比增长 38.87%;归属于上市公司股东的净利润 10.84 亿元,同比增长 81.29%。
IT之家附九号公司 2024 年营业收入划分如下:
自主品牌零售滑板车销量 124.31 万台,收入 24.79 亿元;
电动两轮车销量 259.89 万台(中国区销量 259.32 万台),收入 72.11 亿元;
全地形车销量 2.38 万台,收入 9.76 亿元;
割草机器人收入 8.61 亿元;
ToB 产品直营收入 12.17 亿元;
其他产品及配件收入 14.52 亿元。
电动两轮车销量 259.89 万台(中国区销量 259.32 万台),收入 72.11 亿元;