frontend / features/Project/projectFile / readProjectFile
Function: readProjectFile()
readProjectFile(
file):Promise<ProjectFile>
Defined in: features/Project/projectFile.ts:84
Reads and validates .chef file.
Parses JSON and checks that required fields are present and have correct types. Throws Error if file is not valid JSON or has wrong structure. Caller should catch this error and show message to user.
Note: blocklyState is checked only for being truthy. If state is valid JSON but has wrong shape inside (for example, references block type which does not exist), error will happen later during loading into workspace, not here.
Parameters
file
Blob
File or Blob to read.
Returns
Promise<ProjectFile>
Throws
If content is not valid JSON or does not have python and blocklyState fields.