This file (894B) exceeds the allowed full mode (48 kb) size. The editor full height is disabled, only scrolling is allowed.
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height mode.
const consolePrefix = 'socket.io vectorset getattr'
export default async (options) => {
const {socket, payload} = options;
try {
const redis = socket.p3xrs.ioredis
const { key, element } = payload
const raw = await redis.call('VGETATTR', key, element)
// Parse flat string "field\nvalue\nfield\nvalue" or null
const attrs = {}
if (raw && typeof raw === 'string') {
const parts = raw.split('\n')
for (let i = 0; i < parts.length; i += 2) {
if (parts[i]) attrs[parts[i]] = parts[i + 1] || ''
}
}
socket.emit(options.responseEvent, {
status: 'ok',
attributes: attrs,
})
} catch (e) {
console.error(e)
socket.emit(options.responseEvent, {
status: 'error',
error: e.message,
})
}
}
| / | Focus search |
| ? | Show this help |
| Esc | Unfocus input |