Skip to content

What This Adds In Cloud Code

  • Path joining/normalization helpers in Node style.
  • Useful for building internal file paths for fs reads.

Quick Start

js
const path = require('path');
const filePath = path.join('templates', 'emails', 'welcome.html');

API

Common functions: join, resolve, normalize, dirname, basename, extname, relative, isAbsolute.

Practical Example

js
const fs = require('fs');
const path = require('path');

const file = path.join('schemas', `${request.params.schema}.json`);
const schema = JSON.parse(fs.readFileSync(file));

Failure Modes & Gotchas

  • This is path utility only; actual I/O still depends on Cloud Code fs module.
  • path does not enforce security boundaries by itself; validate user input before building file paths.