Large object support for PostgreSQL clients using the node-postgres (pg) library, enabling streaming of files/objects up to 4 TiB in size. Version 2.0.0 is current stable. Supports both callback (backwards compatible) and promise (Async suffix) interfaces. Key differentiator: streams data in chunks instead of loading entire column into memory. Requires PostgreSQL 8.4+ (9.3+ for seek/tell/size/truncate). Works with pg or pg-promise.
npm install pg-large-objectNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates reading a large object by OID as a stream into a file, using pg-promise and transactions.
Ensure server version >= 9.3 or avoid these methods.
Use buffer size like 16384, 8192, etc.
Wrap operations in db.tx() or BEGIN/COMMIT.
Use {pgPromise: tx} when using pg-promise, or {pg: client} when using raw pg.Run: npm install pg-large-object
Check that you have version >=2.0.0 (npm view pg-large-object version). Use correct import: const { LargeObjectManager } = require('pg-large-object')Ensure user has superuser or largeobject privileges. Run as superuser: CREATE EXTENSION IF NOT EXISTS lo;