# How to Get a List of All Files in GeoLibre: 3 Methods Explained

> Easily list all files in GeoLibre. Discover three powerful methods, including the straightforward git ls-files command, to manage your repository inventory effectively.

- Repository: [Open Geospatial Solutions/GeoLibre](https://github.com/opengeos/GeoLibre)
- Tags: how-to-guide
- Published: 2026-08-18

---

**Run `git ls-files` from the repository root to generate a complete, version-controlled inventory of every file in GeoLibre.**

GeoLibre is a monorepo containing a web-desktop app, TypeScript packages, a Python side-car, and build scripts. Getting a reliable file list means querying the Git index rather than the filesystem, ensuring you capture exactly what's tracked and ignore build artifacts. This article covers three approaches to list all files in GeoLibre, each suited to different workflows.

## Why Use Git to List Files in GeoLibre

GeoLibre's structure spans multiple directories: `apps/`, `packages/`, `.github/`, and configuration files at root. Because the project uses Git for version control, `git ls-files` returns the authoritative list of tracked files. This method works cross-platform and automatically excludes files listed in `.gitignore`—critical for a monorepo with generated build outputs.

## Method 1: Git CLI (Recommended)

The `git ls-files` command is the fastest, most reliable way to get all files in GeoLibre. It reads directly from the Git index.

```bash

# From the repository root

git ls-files > all-files.txt

```

This produces entries such as:

- [`README.md`](https://github.com/opengeos/GeoLibre/blob/main/README.md) – project overview
- [`package.json`](https://github.com/opengeos/GeoLibre/blob/main/package.json) – workspace and dependency definitions
- [`packages/core/src/store.ts`](https://github.com/opengeos/GeoLibre/blob/main/packages/core/src/store.ts) – central Zustand store
- [`apps/geolibre-desktop/vite.config.ts`](https://github.com/opengeos/GeoLibre/blob/main/apps/geolibre-desktop/vite.config.ts) – Vite configuration for desktop builds

Output stays synchronized with commits because Git manages the index automatically.

## Method 2: Node.js Recursive Walk

For JavaScript-based tooling or when you need filesystem-aware behavior, use Node's `fs` module. This includes untracked files—useful for ad-hoc checks during development.

```bash
node -e "require('fs').readdirSync('.', {recursive:true}).forEach(p=>console.log(p))" > all-files.txt

```

To match Git's view and remove duplicates, pipe through `sort | uniq`:

```bash
node -e "require('fs').readdirSync('.', {recursive:true}).forEach(p=>console.log(p))" | sort | uniq > all-files.txt

```

## Method 3: npm Script

GeoLibre provides a pre-configured npm script that wraps the Git command. Check the `scripts` section in [`package.json`](https://github.com/opengeos/GeoLibre/blob/main/package.json):

```json
{
  "scripts": {
    "list-files": "git ls-files"
  }
}

```

Invoke it with:

```bash
npm run list-files > all-files.txt

```

This ensures consistent environment handling when you're already using npm for development tasks.

## Converting Output to JSON

For downstream processing in CI pipelines or data tools, convert the plain list to JSON using `jq`:

```bash
git ls-files | jq -R -s 'split("\n")[:-1]' > all-files.json

```

## Key GeoLibre Files to Know

| Path | Purpose |
|------|---------|
| [`README.md`](https://github.com/opengeos/GeoLibre/blob/main/README.md) | Project overview and quickstart |
| [`package.json`](https://github.com/opengeos/GeoLibre/blob/main/package.json) | Root workspace definition, top-level scripts |
| [`packages/core/src/store.ts`](https://github.com/opengeos/GeoLibre/blob/main/packages/core/src/store.ts) | Central state management (Zustand) |
| [`packages/plugins/src/plugins/weather-layer.ts`](https://github.com/opengeos/GeoLibre/blob/main/packages/plugins/src/plugins/weather-layer.ts) | Built-in weather raster plugin |
| [`apps/geolibre-desktop/vite.config.ts`](https://github.com/opengeos/GeoLibre/blob/main/apps/geolibre-desktop/vite.config.ts) | Desktop app build configuration |
| [`.github/workflows/ci.yml`](https://github.com/opengeos/GeoLibre/blob/main/.github/workflows/ci.yml) | Continuous integration pipeline |
| [`docker-compose.yml`](https://github.com/opengeos/GeoLibre/blob/main/docker-compose.yml) | Local development orchestration |

These files reveal GeoLibre's architecture: a plugin-based core, desktop and web app variants, and containerized development workflows.

## Summary

- **`git ls-files`** – authoritative, version-controlled file list; ignores build artifacts automatically
- **Node.js `readdirSync`** – filesystem walk including untracked files; useful for tooling integration
- **`npm run list-files`** – convenience wrapper matching the Git CLI approach

All three methods answer how to get a list of all files in GeoLibre. Choose based on whether you need Git's accuracy, filesystem awareness, or npm workflow integration.

## Frequently Asked Questions

### What is the fastest way to list all files in GeoLibre?

**`git ls-files`** from the repository root. It executes in milliseconds and requires no dependencies beyond Git, which you already need to clone the repository.

### Does `git ls-files` show untracked files?

No. `git ls-files` only reports files Git is already tracking. Use the Node.js `readdirSync` method if you need untracked files, or run `git status` to see what's uncommitted.

### Where is the npm `list-files` script defined?

In the root [`package.json`](https://github.com/opengeos/GeoLibre/blob/main/package.json) under the `scripts` object. As implemented in opengeos/GeoLibre, it executes `git ls-files` with no additional filtering.

### Can I filter the file list to specific directories?

Yes. Append a pathspec to `git ls-files`: `git ls-files packages/core/` returns only files in that package. For pattern matching, use `git ls-files '*.ts'` to find all TypeScript files.