Docs / Settings and looks
The Working Folder
Every Node Run works in one folder, the Working Folder. The files your Snippets write are kept there.
What it is
A Node Run starts in the Working Folder. A file your Snippet writes by a relative path, such as fs.writeFileSync('notes.txt', text), or beside __dirname, lands there. It stays after the Run and after you quit, until you empty the folder.
- Every Node Snippet uses the same folder, so one Snippet can read a file another one wrote.
- Everything in it is yours: JSpark keeps nothing of its own there once a Run ends. In a Working Folder you chose in Settings, it adds one
node_moduleslink, so your Snippets can import installed packages. - It is where relative paths go, not a limit. A Snippet can still read and write anywhere you can. See Outside Access.
Open it
- Choose Run → Reveal Working Folder.
- Or open Settings → About and click Reveal in Finder under Working folder.
Settings shows where the folder is and how much it holds. Copy path, beside the path, copies it.
- Node snippets
- Node 24.21.0
- Web snippets
- Chromium 152.0.7977.130
- JavaScript engine
- V8 15.2.124.28
Downloads new versions in the background and installs them when you quit.
- License Agreement
- Privacy Policy
- Refund Policy
Working folder
12 KBWhere Node snippets run: a file written to a relative path, or beside __dirname, lands here and stays until you empty it.
Change or empty it
Change it
- In Settings → About, click Change… under Working folder.
- Pick an empty folder, or make a new one in the window that opens.
JSpark moves everything from the current folder into the new one, and Node Runs work there from then on.
It refuses a folder that isn’t empty, a folder it can’t write to, and a folder inside the current one or holding it. It says why, and nothing is moved.
If the folder you chose is missing when JSpark starts, for example on a drive that isn’t connected, JSpark goes back to its own folder and tells you. Choose your folder again in Settings when it is back.
Empty it
- In Settings → About, click Empty… under Working folder.
- Click Empty to confirm.
Every file your Snippets wrote there is deleted. This can’t be undone. The button is greyed out while the folder is empty. A Run still running keeps the file it needs.
Run in a folder of your own JSpark+
In JSpark+, one Node Snippet can run in a folder you choose, such as a project of yours, instead of the Working Folder. Use it to import your own modules, as in import { slugify } from './utils.js', or to read a project’s files by relative path.
- Open the Node Snippet.
- Choose Run → Run in Folder….
- Pick a folder, or make a new one, and click Run Here.
The footer names the folder, and every Node Run of that Snippet works there, the Timeline included:
process.cwd()is the folder.- A relative
import,requireorfspath starts from the folder. - A package import looks in the project’s own
node_modulesfirst, then in the packages installed in JSpark. See Packages.
To go back, click the × after the folder’s name: Run in the Working Folder instead. The other Snippets always run in the Working Folder.
Good to know
- The Snippet waits for you to press Run: Run as you type pauses for it, because its Runs work with your real files. The rail says Uses a folder of yours, so auto-run is paused. See Outside Access.
- While a Run works, JSpark writes the Snippet as a hidden file beside your code, named like
.jspark-run-1.mjs(or.cjs), and removes it when the Run ends. If JSpark quits in the middle of a Run, it removes the file at the next launch. In a Git project, add.jspark-run-*to your.gitignore. JSpark puts nothing else in your folder. - The folder is kept on the tab, also after you quit and open JSpark again. It is never saved in the Library or an export, because a path means nothing on another computer.
- If the folder is gone, for example on a drive that isn’t connected, the Snippet runs in the Working Folder and the console says The folder … isn’t there any more, so this ran in the Working Folder.
- Run in Folder… is for Node Snippets. It isn’t offered in the Timeline: leave it first.
In JSpark, choosing Run in Folder… says that running in a folder of your own needs JSpark+. If a Yearly key lapses, a Snippet already set to a folder keeps running there; setting another folder asks for JSpark+.
The pictures show JSpark on a Mac. On Windows, the window buttons are at the top right, the menus are in theMenu button at the left end of the tabs, and shortcuts use Ctrl where a Mac uses ⌘. The rest works the same way.