
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
files-from-path
Advanced tools
Expand paths to file-like objects with name, readable stream and size.
Expand paths to file-like objects with name, readable stream and size.
npm install files-from-path
import { filesFromPaths } from 'files-from-path'
// Given a file system like:
// path/to/file.txt
// path/to/dir/a.pdf
// path/to/dir/images/cat.gif
const files = await filesFromPaths(['path/to/file.txt', 'path/to/dir'])
console.log(files)
// Output:
// [
// { name: 'file.txt', stream: [Function: stream] },
// { name: 'dir/b.pdf', stream: [Function: stream] },
// { name: 'dir/images/cat.gif', stream: [Function: stream] },
// ]
// Note: common sub-path ("path/to/") is removed.
filesFromPaths
The following parameters can be provided to filesFromPaths
:
Name | Type | Description |
---|---|---|
paths | Iterable<string> | File system path(s) to read from |
[options] | object | options |
[options.hidden] | boolean | Include .dot files in matched paths (default: false ) |
[options.sort] | boolean | Sort files by path (default: true ) |
It returns an array of file-like objects in the form:
{
name: string
stream: () => ReadableStream<Uint8Array>
size: number
}
Releasing to npm is done via release-please
. A Release PR will be opened with a CHANGELOG update in after a PR is merged to main. Merging the release PR will publish the new version to npm.
Feel free to join in. All welcome. Please open an issue!
Dual-licensed under Apache 2.0 OR MIT
FAQs
Expand paths to file-like objects with name, readable stream and size.
The npm package files-from-path receives a total of 14,582 weekly downloads. As such, files-from-path popularity was classified as popular.
We found that files-from-path demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.