René's URL Explorer Experiment


Title: fs: support Buffer paths in cp() and cpSync() by HuzaifaAbdulRehman · Pull Request #65713 · nodejs/node · GitHub

Open Graph Title: fs: support Buffer paths in cp() and cpSync() by HuzaifaAbdulRehman · Pull Request #65713 · nodejs/node

X Title: fs: support Buffer paths in cp() and cpSync() by HuzaifaAbdulRehman · Pull Request #65713 · nodejs/node

Description: What breaks fs.cpSync() with a filter, and fs.promises.cp(), throw ERR_INVALID_ARG_TYPE when src or dest is a Buffer, though Buffer paths are accepted elsewhere in fs (they address non-UTF-8 byte file names on POSIX). const { cpSync, mkdirSync } = require('node:fs'); mkdirSync('a/c', { recursive: true }); cpSync(Buffer.from('a'), Buffer.from('b'), { recursive: true, filter: () => true }); // TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. // at join (node:path) // at copyDir (node:internal/fs/cp/cp-sync) Root cause The recursive walk builds child paths with path.join(src, name), and the async path also runs path.resolve() / path.dirname() in its structural checks. All reject a Buffer. cpSync without a filter avoids it (that branch runs in C++); cp.promises hits it in isSrcSubdir before copying. The change joinPath joins entries onto Buffer paths by concatenating bytes, and copyDir reads entries with encoding: 'buffer' for Buffer sources, so non-UTF-8 names survive rather than being mangled. toPathString decodes to a string only for the subdirectory and parent-directory checks; the copy keeps the Buffers. String paths over a non-UTF-8-named entry stay unchanged (a string cannot carry those bytes) and remain a known issue, nearer #58869. Tests Promotes the two #58634 known-issue tests into test/parallel/ and adds a Linux-only byte-fidelity test (a Shift-JIS file name copied intact through Buffer paths). Fixes: #58634

Open Graph Description: What breaks fs.cpSync() with a filter, and fs.promises.cp(), throw ERR_INVALID_ARG_TYPE when src or dest is a Buffer, though Buffer paths are accepted elsewhere in fs (they address non-UTF-8 byte f...

X Description: What breaks fs.cpSync() with a filter, and fs.promises.cp(), throw ERR_INVALID_ARG_TYPE when src or dest is a Buffer, though Buffer paths are accepted elsewhere in fs (they address non-UTF-8 byte f...

Opengraph URL: https://github.com/nodejs/node/pull/65713

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:44c6955a-08e6-bfb3-5384-fccdb2f4dea7
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD62A:2973C7:697D06:88D0C5:6AED2D8E
html-safe-nonce8d1fc57628273878ed945ae06c793dbae7f793acd29c13c9ad7563109eda85c2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjJBOjI5NzNDNzo2OTdEMDY6ODhEMEM1OjZBRUQyRDhFIiwidmlzaXRvcl9pZCI6IjgzNDI5MzEyMjIxNjk0NjQyMDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca77f5197c5c86df549120604b1c930eddbd7739e04bd1d02d4d37cd2eb53b4cf
hovercard-subject-tagpull_request:4414761179
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/65713/files
twitter:imagehttps://avatars.githubusercontent.com/u/143286445?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/143286445?s=400&v=4
og:image:altWhat breaks fs.cpSync() with a filter, and fs.promises.cp(), throw ERR_INVALID_ARG_TYPE when src or dest is a Buffer, though Buffer paths are accepted elsewhere in fs (they address non-UTF-8 byte f...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/65713/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F65713%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F65713%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/65713/files
Reloadhttps://github.com/nodejs/node/pull/65713/files
Reloadhttps://github.com/nodejs/node/pull/65713/files
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
HuzaifaAbdulRehmanhttps://github.com/HuzaifaAbdulRehman
nodejs:mainhttps://github.com/nodejs/node/tree/main
HuzaifaAbdulRehman:fix/58634-cp-buffer-paths-filterhttps://github.com/HuzaifaAbdulRehman/node/tree/fix/58634-cp-buffer-paths-filter
Conversation 2 https://github.com/nodejs/node/pull/65713
Commits 1 https://github.com/nodejs/node/pull/65713/commits
Checks 30 https://github.com/nodejs/node/pull/65713/checks
Files changed https://github.com/nodejs/node/pull/65713/files
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
fs: support Buffer paths in cp() and cpSync() https://github.com/nodejs/node/pull/65713/files#top
Show all changes 1 commit https://github.com/nodejs/node/pull/65713/files
004d3c3 fs: support Buffer paths in cp() and cpSync() HuzaifaAbdulRehman Aug 31, 2026 https://github.com/nodejs/node/pull/65713/commits/004d3c32fcafad915e4e09ce4d0d528095d7f11f
Clear filters https://github.com/nodejs/node/pull/65713/files
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
cp-sync.js https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
cp.js https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
test-fs-cp-async-buffer.js https://github.com/nodejs/node/pull/65713/files#diff-30326b568f557bcb3fe01bc87b767fb5bd4d788332796e1a6a5fba9f70fd8297
test-fs-cp-filter.js https://github.com/nodejs/node/pull/65713/files#diff-8f4c74f8002efe4e2badc6241816a8aad6d2ffd3da87db7788662674479bb405
test-fs-cp-async-buffer.js https://github.com/nodejs/node/pull/65713/files#diff-779ea3dc1d2bb8a37758cb3689f0aa6506321e6de8076a8f5f4d18761bd6cdae
test-fs-cp-buffer-non-utf8.js https://github.com/nodejs/node/pull/65713/files#diff-f7e2e51a2259d44e01cd9e120cec1e869d3f7e16302fea9e2d306d2fbc5081cc
test-fs-cp-filter.js https://github.com/nodejs/node/pull/65713/files#diff-d6e0bc6084e50ab570922e8287cc77fe732fdf3e2c28560354eb41ea26f2ba44
lib/internal/fs/cp/cp-sync.jshttps://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
View file https://github.com/nodejs/node/blob/004d3c32fcafad915e4e09ce4d0d528095d7f11f/lib/internal/fs/cp/cp-sync.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65713/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
https://github.com/nodejs/node/pull/65713/files#diff-a67e55d88b5a4c268de164070ed6f84d7d00acc531de31a112512ee36d626566
lib/internal/fs/cp/cp.jshttps://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
View file https://github.com/nodejs/node/blob/004d3c32fcafad915e4e09ce4d0d528095d7f11f/lib/internal/fs/cp/cp.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65713/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
https://github.com/nodejs/node/pull/65713/files#diff-e34f19752c826e2c7167fb839319cb3b6fc6c24c6b94cc85af2df3d7b50a2775
test/known_issues/test-fs-cp-async-buffer.jshttps://github.com/nodejs/node/pull/65713/files#diff-30326b568f557bcb3fe01bc87b767fb5bd4d788332796e1a6a5fba9f70fd8297
View file https://github.com/nodejs/node/blob/e68a93a8e9823e7faa0dce2c0a1521c49246c8b6/test/known_issues/test-fs-cp-async-buffer.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
test/known_issues/test-fs-cp-filter.jshttps://github.com/nodejs/node/pull/65713/files#diff-8f4c74f8002efe4e2badc6241816a8aad6d2ffd3da87db7788662674479bb405
View file https://github.com/nodejs/node/blob/e68a93a8e9823e7faa0dce2c0a1521c49246c8b6/test/known_issues/test-fs-cp-filter.js
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
test/parallel/test-fs-cp-async-buffer.jshttps://github.com/nodejs/node/pull/65713/files#diff-779ea3dc1d2bb8a37758cb3689f0aa6506321e6de8076a8f5f4d18761bd6cdae
View file https://github.com/nodejs/node/blob/004d3c32fcafad915e4e09ce4d0d528095d7f11f/test/parallel/test-fs-cp-async-buffer.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65713/{{ revealButtonHref }}
test/parallel/test-fs-cp-buffer-non-utf8.jshttps://github.com/nodejs/node/pull/65713/files#diff-f7e2e51a2259d44e01cd9e120cec1e869d3f7e16302fea9e2d306d2fbc5081cc
View file https://github.com/nodejs/node/blob/004d3c32fcafad915e4e09ce4d0d528095d7f11f/test/parallel/test-fs-cp-buffer-non-utf8.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65713/{{ revealButtonHref }}
test/parallel/test-fs-cp-filter.jshttps://github.com/nodejs/node/pull/65713/files#diff-d6e0bc6084e50ab570922e8287cc77fe732fdf3e2c28560354eb41ea26f2ba44
View file https://github.com/nodejs/node/blob/004d3c32fcafad915e4e09ce4d0d528095d7f11f/test/parallel/test-fs-cp-filter.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65713/{{ revealButtonHref }}
Please reload this pagehttps://github.com/nodejs/node/pull/65713/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.