Home / Function/ with_tmp_dir() — svelte Function Reference

with_tmp_dir() — svelte Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  81442520_c7b6_8cb3_33ad_d9a61bb07102["with_tmp_dir()"]
  65d20932_41e6_eeee_7338_5dd0682e5e42["download.js"]
  81442520_c7b6_8cb3_33ad_d9a61bb07102 -->|defined in| 65d20932_41e6_eeee_7338_5dd0682e5e42
  style 81442520_c7b6_8cb3_33ad_d9a61bb07102 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playgrounds/sandbox/scripts/download.js lines 583–597

async function with_tmp_dir(base_dir, action) {
	const tmp_dir = path.join(base_dir, '.tmp-repo');

	try {
		if (fs.existsSync(tmp_dir)) {
			fs.rmSync(tmp_dir, { recursive: true, force: true });
		}
		fs.mkdirSync(tmp_dir, { recursive: true });
		await action(tmp_dir);
	} finally {
		if (fs.existsSync(tmp_dir)) {
			fs.rmSync(tmp_dir, { recursive: true, force: true });
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does with_tmp_dir() do?
with_tmp_dir() is a function in the svelte codebase, defined in playgrounds/sandbox/scripts/download.js.
Where is with_tmp_dir() defined?
with_tmp_dir() is defined in playgrounds/sandbox/scripts/download.js at line 583.

Analyze Your Own Codebase

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

Try Supermodel Free