openai-node icon indicating copy to clipboard operation
openai-node copied to clipboard

docs(files): clarify files.content returns Response object

Open dhofheinz opened this issue 4 months ago • 0 comments

Changes being requested

Updated documentation for openai.files.content() to clarify that it returns a Response object, not raw file content. The previous JSDoc comment was ambiguous, leading users to expect file content directly.

What changed:

  • Enhanced JSDoc comment to explicitly state Response object is returned
  • Added documentation for .text(), .blob(), and .arrayBuffer() consumption methods
  • Provided two practical code examples in JSDoc
  • Created a comprehensive example file demonstrating all consumption patterns

Files modified:

  • src/resources/files.ts - Updated JSDoc (lines 66-85)
  • examples/file-content-retrieval.ts - New example file (NEW)

Additional context & links

This addresses the 15-month-old issue #958 where users were confused about the return type. The fix follows the exact pattern established in src/resources/audio/speech.ts for documenting Response-returning methods.

Validation:

  • ✅ All but one tests passing (680/681)
  • ✅ Build successful
  • ✅ Linting clean

Fixes #958


Note: I understand that this repository is auto-generated and my pull request may not be merged. However, this documentation enhancement provides immediate value to users and follows the established patterns in the codebase. The examples/ directory is protected from generator overwrites, ensuring the example file persists.

dhofheinz avatar Oct 06 '25 04:10 dhofheinz