| postgresExportLargeObject | R Documentation |
Exports a large object from the database to a file on disk. This function
uses PostgreSQL's lo_export() function which efficiently streams the data
directly to disk without loading it into memory, making it suitable for
very large objects (GB+) that would cause memory issues with lo_get().
This function must be called within a transaction.
postgresExportLargeObject(conn, oid, filepath)
conn |
a PqConnection object, produced by
|
oid |
the object identifier (Oid) of the large object to export |
filepath |
a path where the large object should be exported |
invisible NULL on success, or stops with an error
## Not run:
con <- postgresDefault()
filepath <- 'your_image.png'
dbWithTransaction(con, {
oid <- postgresImportLargeObject(con, filepath)
})
# Later, export the large object back to a file
dbWithTransaction(con, {
postgresExportLargeObject(con, oid, 'exported_image.png')
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.