Glob with route-like capturing of parameters.
Match files or directories with glob strings and capture parts of the file path as named parameters.
For example, a path like graphics/en/chart/index.html can be captured with parameters like graphics/{locale}/{slug}/*.html.
graphics/en/chart/index.html
graphics/{locale}/{slug}/*.html
import { utils } from '@reuters-graphics/graphics-bin';utils.fs.glob<{ locale: string }>('graphics/{locale}/interactive');// Capture for: graphics/en/interactive/// [{ path: 'graphics/en/interactive', params: { locale: 'en' }}]utils.fs.glob<{ locale: string }>('graphics/{locale}-chart');// Capture for: graphics/de-chart/// [{ path: 'graphics/de-chart', params: { locale: 'de' }}]utils.fs.glob('**/*.html'); // Ignore the escape in the slash// Capture for: graphics/en/interactive/index.html// [{ path: 'graphics/en/interactive/index.html', params: {}}] Copy
import { utils } from '@reuters-graphics/graphics-bin';utils.fs.glob<{ locale: string }>('graphics/{locale}/interactive');// Capture for: graphics/en/interactive/// [{ path: 'graphics/en/interactive', params: { locale: 'en' }}]utils.fs.glob<{ locale: string }>('graphics/{locale}-chart');// Capture for: graphics/de-chart/// [{ path: 'graphics/de-chart', params: { locale: 'de' }}]utils.fs.glob('**/*.html'); // Ignore the escape in the slash// Capture for: graphics/en/interactive/index.html// [{ path: 'graphics/en/interactive/index.html', params: {}}]
Glob with route-like capturing of parameters.
Match files or directories with glob strings and capture parts of the file path as named parameters.
For example, a path like
graphics/en/chart/index.html
can be captured with parameters likegraphics/{locale}/{slug}/*.html
.Example