Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

files-from-path

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

files-from-path

Match provided glob paths to file objects with readable stream

  • 0.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.9K
increased by5.77%
Maintainers
2
Weekly downloads
 
Created
Source

files-from-path

Match provided glob paths to file objects with readable stream

Build dependencies Status JavaScript Style Guide Downloads Minzipped size

Install

# install it as a dependency
$ npm i files-from-path

Usage

import { filesFromPath } from 'files-from-path'

for await (const f of filesFromPath(`path/to/somewhere`)) {
  console.log(f)
  // { name: '/path/to/me', stream: [Function: stream] }
}

API

filesFromPath

The following parameters can be provided to filesFromPath.

NameTypeDescription
paths`IterableAsyncIterable
[options]objectoptions
[options.hidden]booleanInclude .dot files in matched paths
[options.ignore]string[]Glob paths to ignore
[options.followSymlinks]booleanfollow symlinks
[options.preserveMode]booleanpreserve mode
[options.mode]numbermode to use - if preserveMode is true this will be ignored
[options.preserveMtime]booleanpreserve mtime
[options.pathPrefix]stringbase path prefix that will get stripped out of the filenames yielded

It yields file like objects in the form of { name: String, stream: AsyncIterator<Buffer> }

getFilesFromPath

This takes the same parameters as filesFromPath, but returns a Promise<{ name: String, stream: AsyncIterator<Buffer> }[]> by creating an array with all the yield file like objects from the path.

Releasing

You can publish by either running npm publish in the dist directory or using npx ipjs publish.

FAQs

Package last updated on 31 Mar 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc