Home / Function/ get_all_files() — svelte Function Reference

get_all_files() — svelte Function Reference

Architecture documentation for the get_all_files() function in download.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  7f0ea1c2_2714_c186_16e3_baa473ab323e["get_all_files()"]
  65d20932_41e6_eeee_7338_5dd0682e5e42["download.js"]
  7f0ea1c2_2714_c186_16e3_baa473ab323e -->|defined in| 65d20932_41e6_eeee_7338_5dd0682e5e42
  04de3495_cffc_dc6d_e930_d1c6d03a3a34["convert_sveltekit_project()"]
  04de3495_cffc_dc6d_e930_d1c6d03a3a34 -->|calls| 7f0ea1c2_2714_c186_16e3_baa473ab323e
  2d1f4cc1_c2e4_e70c_5eaa_0161ef52d12e["convert_vite_project()"]
  2d1f4cc1_c2e4_e70c_5eaa_0161ef52d12e -->|calls| 7f0ea1c2_2714_c186_16e3_baa473ab323e
  2e34f7ff_3d9b_3d31_75ac_8a472947d75a["process_directory()"]
  2e34f7ff_3d9b_3d31_75ac_8a472947d75a -->|calls| 7f0ea1c2_2714_c186_16e3_baa473ab323e
  style 7f0ea1c2_2714_c186_16e3_baa473ab323e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playgrounds/sandbox/scripts/download.js lines 203–235

function get_all_files(dir, base = '') {
	/** @type {Array<{path: string, name: string, contents: string}>} */
	const results = [];

	if (!fs.existsSync(dir)) return results;

	const entries = fs.readdirSync(dir, { withFileTypes: true });

	for (const entry of entries) {
		const full_path = path.join(dir, entry.name);
		const relative_path = base ? `${base}/${entry.name}` : entry.name;

		if (entry.isDirectory()) {
			// Skip node_modules, .git, etc.
			if (['node_modules', '.git', '.svelte-kit', 'build', 'dist'].includes(entry.name)) {
				continue;
			}
			results.push(...get_all_files(full_path, relative_path));
		} else if (
			entry.name.endsWith('.svelte') ||
			entry.name.endsWith('.js') ||
			entry.name.endsWith('.ts')
		) {
			results.push({
				path: relative_path,
				name: entry.name,
				contents: fs.readFileSync(full_path, 'utf-8')
			});
		}
	}

	return results;
}

Domain

Subdomains

Frequently Asked Questions

What does get_all_files() do?
get_all_files() is a function in the svelte codebase, defined in playgrounds/sandbox/scripts/download.js.
Where is get_all_files() defined?
get_all_files() is defined in playgrounds/sandbox/scripts/download.js at line 203.
What calls get_all_files()?
get_all_files() is called by 3 function(s): convert_sveltekit_project, convert_vite_project, process_directory.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free