New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

magic-paths

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-paths

"Magic path" resolutions using preset prefixes and globbing

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Magic Paths

Expand prefixed glob patterns into an array of matching files. The real advantage of this over using a glob matching library by itself is to be able to use path shortcuts that can reference one or more base location.

Instead of this: some/deeply/nested/folder/*.* you can set a prefix and reference the files in the folder like this nested:*.*. Very useful when the prefix references multiple locations.

Usage

var magic = require('magic-paths');

var options = {
    prefixes: {
        rel_fixture: 'test/fixtures/'
    }
};

// Fetch files (callback style)
magic.expand('rel_fixture:*.html', options, function(err, files) {
    // ...
});

// Fetch files (promise style)
magic.expand('rel_fixture:*.html', options).then(function(files) {
    // ...
}).catch(function(err){})

Note: - the trailing slash for directory prefixes is important. Prefixes may not necessarily be full directory paths so it's not possible to automagically resolve them as such.

Keywords

FAQs

Package last updated on 08 May 2023

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