{"id":43650,"library":"postgres-blob-store","title":"postgres-blob-store","description":"PostgreSQL implementation of abstract-blob-store, currently at version 3.0.0. This package stores binary files as base64 strings in text columns, not as bytea. It is experimental and designed for server-side Node.js use with PostgreSQL. Works with any abstract-blob-store compatible consumer. Last updated in 2016, no recent releases.","status":"maintenance","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/finnp/postgres-blob-store","tags":["javascript","blob-store","blob","postgres"],"install":[{"cmd":"npm install postgres-blob-store","lang":"bash","label":"npm"},{"cmd":"yarn add postgres-blob-store","lang":"bash","label":"yarn"},{"cmd":"pnpm add postgres-blob-store","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required interface for blob store compatibility","package":"abstract-blob-store","optional":false},{"reason":"PostgreSQL client for database operations","package":"pg","optional":false},{"reason":"Stream transformation for reading/writing blobs","package":"through2","optional":false}],"imports":[{"note":"The module exports a single function as default. CommonJS require returns the function directly, not an object.","wrong":"const { blob } = require('postgres-blob-store')","symbol":"default","correct":"import blob from 'postgres-blob-store'"},{"note":"CommonJS require returns the exporter function directly; there is no named export.","wrong":"const { createBlobStore } = require('postgres-blob-store')","symbol":"postgres-blob-store (require)","correct":"const blob = require('postgres-blob-store')"},{"note":"This package does not ship TypeScript definitions. You may need to create a .d.ts file or use @types/abstract-blob-store.","wrong":"","symbol":"TypeScript usage","correct":"import blob from 'postgres-blob-store'"}],"quickstart":{"code":"const blob = require('postgres-blob-store');\nconst fs = require('fs');\nconst store = blob({ url: process.env.DATABASE_URL ?? 'postgresql://localhost:5432/blob' });\n\n// Write a blob\nconst ws = store.createWriteStream((err, meta) => {\n  if (err) throw err;\n  console.log('Saved:', meta.key);\n  // Read it back\n  const rs = store.createReadStream(meta.key);\n  rs.pipe(fs.createWriteStream('./output.txt'));\n});\nfs.createReadStream('./input.txt').pipe(ws);","lang":"javascript","description":"Connects to PostgreSQL, reads a file, writes it as a blob, then reads it back to another file."},"warnings":[{"fix":"Switch to a blob store that uses bytea, or accept overhead.","message":"Data stored as base64 text, not bytea, causing ~33% storage overhead","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider alternatives like node-pg-blob-store or implement using bytea directly.","message":"Experimental: no official releases since 2016; may have unaddressed bugs","severity":"gotcha","affected_versions":"*"},{"fix":"Wrap in a Promise manually for modern Node.js patterns.","message":"Requires callback-based initialization; no promise or async/await support","severity":"gotcha","affected_versions":"*"},{"fix":"Replace with native Node.js streams (Transform) in your code.","message":"Dependency 'through2' is no longer maintained","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'2016':55 '3.0.0':15 'abstract':9,47 'abstract-blob-stor':8,46 'base64':22 'binari':19 'blob':3,10,48,61,63 'blob-stor':60 'bytea':29 'column':26 'compat':50 'consum':51 'current':12 'design':34 'experiment':32 'file':20 'implement':6 'javascript':59 'last':52 'node.js':39 'packag':17 'postgr':2,64 'postgres-blob-stor':1 'postgresql':5,42 'recent':57 'releas':58 'server':37 'server-sid':36 'side':38 'store':4,11,18,49,62 'string':23 'text':25 'updat':53 'use':40 'version':14 'work':43","created_at":"2026-06-05T17:00:48.906598+00:00","updated_at":"2026-06-05T17:00:48.906598+00:00","problems":[{"fix":"Ensure you pass {url: 'postgresql://...'} or set DATABASE_URL env var.","cause":"Missing or incorrect connection URL","error":"Error: no pg config"},{"fix":"Use const blob = require('postgres-blob-store'); then blob({...}).createWriteStream(...)","cause":"Using a named import instead of default import","error":"TypeError: store.createWriteStream is not a function"},{"fix":"Run: CREATE TABLE blobs (key text primary key, blob text NOT NULL);","cause":"Table not automatically created; need to create it","error":"Error: relation \"blobs\" does not exist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/finnp/postgres-blob-store","github":"https://github.com/finnp/postgres-blob-store","docs":null,"changelog":null,"pypi":null,"npm":"postgres-blob-store","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}