DeprecationWarning

未关闭
#1,504 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
领域
backend

调研方向

先使用提供的 doc.image 调用和 Node 20.11.0 下的 PNG 路径复现该警告,然后跟踪 pdfkit 0.14.0 使用的 PNG 图像加载路径。完成的标准是 PNG 情况不再发出已弃用的 Buffer() 警告,同时 JPG 处理保持正常;该 issue 没有指出应从哪个源文件或测试开始。

由索引模型根据 Issue 内容生成。

描述

Code sample

 doc.image(path.join(__dirname, '../../../../assets/myLogo.png'), 390, 20, { width: 180 });

Bug Report

I got a Deprecation warning when i put an image on my pdf

this line cause me this error:
(node:127) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

When the file extension is .jpg there is no error.

  • pdfkit version: 0.14.0
  • Node version: 20.11.0
  • Operating System: macOS 14.3.1

Run in a lambda with serverless offline

主要语言
JavaScript
星标
10.7k
派生
1.2k
平均合并
21 小时 41 分钟
30 天内合并 PR
27

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

foliojs/pdfkit 的其他 Issue

查看 foliojs/pdfkit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。