
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@fernforestgames/godot-resource-parser
Advanced tools
A TypeScript/JavaScript library for parsing Godot 4's .tscn (scene) and .tres (resource) files.
npm install @fernforestgames/godot-resource-parser
import { parse, parseScene, parseResource } from '@fernforestgames/godot-resource-parser';
import * as fs from 'fs';
// Auto-detect file type (scene or resource)
const content = fs.readFileSync('scene.tscn', 'utf8');
const parsed = parse(content);
// Parse scene file (.tscn)
const scene = parseScene(content);
console.log(scene.nodes); // Access scene nodes
console.log(scene.connections); // Access signal connections
// Parse resource file (.tres)
const resourceContent = fs.readFileSync('material.tres', 'utf8');
const resource = parseResource(resourceContent);
console.log(resource.resource?.properties); // Access resource properties
import { isGodotScene, isVector3, isColor } from '@fernforestgames/godot-resource-parser';
const result = parse(content);
if (isGodotScene(result)) {
// TypeScript knows this is a GodotScene
result.nodes.forEach(node => {
console.log(node.name, node.type);
});
}
// Check value types
const position = node.properties.position;
if (isVector3(position)) {
console.log(`Position: ${position.x}, ${position.y}, ${position.z}`);
}
The package includes a command-line tool for parsing Godot files into an AST. You can run it using npx or install it globally:
# Parse a file
npx @fernforestgames/godot-resource-parser scene.tscn > output.json
# Parse from stdin
cat scene.tscn | godot-resource-parser > output.json
// Auto-detects and parses either a scene or resource file.
parse(content: string): ParsedGodotFile;
// Parses a Godot scene file (`.tscn`). Throws error if file is not a scene.
parseScene(content: string): GodotScene;
// Parses a Godot resource file (`.tres`). Throws error if file is not a resource.
parseResource(content: string): GodotResource;
interface GodotScene {
header: GdSceneHeader
extResources: ExtResource[]
subResources: SubResource[]
nodes: Node[]
connections: Connection[]
editables: Editable[]
}
interface Node {
name: string
type: string
parent?: string
instance?: ExtResourceRef
owner?: string
index?: number
groups?: string[]
properties: Record<string, GodotValue>
}
interface Connection {
signal: string
from: string
to: string
callable?: string
method?: string // Legacy support
flags?: number
binds?: GodotValue[]
unbinds?: number
}
interface GodotResource {
header: GdResourceHeader
extResources: ExtResource[]
subResources: SubResource[]
resource?: ResourceSection
}
interface ResourceSection {
properties: Record<string, GodotValue>
}
// File type guards
isGodotScene(value): value is GodotScene
isGodotResource(value): value is GodotResource
// Value type guards
isVector2(value): value is Vector2
isVector3(value): value is Vector3
isColor(value): value is Color
isExtResourceRef(value): value is ExtResourceRef
isSubResourceRef(value): value is SubResourceRef
Released under the MIT License. See the LICENSE file for details.
FAQs
Parser for Godot 4 .tscn and .tres files
We found that @fernforestgames/godot-resource-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.