MCPcopy Index your code
hub / github.com/callstack/agent-device / readPushPayloadFile

Function readPushPayloadFile

src/core/dispatch-payload.ts:23–41  ·  view source on GitHub ↗
(payloadPath: string)

Source from the content-addressed store, hash-verified

21}
22
23async function readPushPayloadFile(payloadPath: string): Promise<string> {
24 try {
25 return await fs.readFile(payloadPath, 'utf8');
26 } catch (error) {
27 const code = (error as NodeJS.ErrnoException).code;
28 if (code === 'ENOENT') {
29 throw new AppError('INVALID_ARGS', `Push payload file not found: ${payloadPath}`);
30 }
31 if (code === 'EISDIR') {
32 throw new AppError('INVALID_ARGS', `Push payload path is not a file: ${payloadPath}`);
33 }
34 if (code === 'EACCES' || code === 'EPERM') {
35 throw new AppError('INVALID_ARGS', `Push payload file is not readable: ${payloadPath}`);
36 }
37 throw new AppError('COMMAND_FAILED', `Unable to read push payload file: ${payloadPath}`, {
38 cause: String(error),
39 });
40 }
41}

Callers 1

readNotificationPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…