3 How To Use
Flufi Boi edited this page 2026-07-11 14:42:30 +00:00

Note

scsf was made with deno, but should work perfectly fine on other runtimes, as it never directly communicates with deno (except from these examples)

scsf is seperated into 4 parts,

  • parsing from (project).json, which is located on each of the component classes, e.g. parsing sounds is located in Sound.parseJson(data), data being the result of JSON.parse()
  • converting the classes back into json, which is also located on each class, TheClass.outputJson()
  • writing as scsf, which is all located in writer.ts
  • reading from scsf, which is located in reader.ts

Parsing a project.json

const data = JSON.parse(/* text of project.json */);
// or
const data = /* parsed json of project.json */;

const project = Project.parseJson(data);

Converting back into project.json

const project = /* ... */;

const json = project.outputJson();

// or whatever
Deno.writeTextFileSync("./project.json", JSON.stringify(json));

Writing a scsf file

const project = /* ... */;

const writer = new Writer();
writer.writeProject(project);

const scsf = writer.getFlattened();

Deno.writeTextFileSync("./scsf.json", JSON.stringify(scsf));

Reading a scsf file

const data = Deno.readTextFileSync("./scsf.json");
const scsf = JSON.parse(data);

const reader = new Reader();

const project = reader.readProject(scsf);