MCPcopy Create free account
hub / github.com/Premkolte/AnimateHub / readCodeFile

Function readCodeFile

backend/src/controllers/components.controller.js:13–22  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

11 * Read uploaded file content as UTF-8 text
12 */
13const readCodeFile = (file) => {
14 try {
15 return file.buffer.toString("utf-8");
16 } catch (error) {
17 throw new ApiError(400, "Error reading the uploaded file");
18 }
19};
20
21/**
22 * Ensure user is owner of the component or an admin
23 */
24const checkOwnershipOrAdmin = (component, userId, isAdmin, action) => {
25 if (component.submittedBy.toString() !== userId.toString() && !isAdmin) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected